Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused subset of the flagset interface. #508

Merged
merged 2 commits into from
Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,6 @@ type FlagSet interface {
Float64(name string, def float64, usage string) *float64
String(name string, def string, usage string) *string

// BoolVar, IntVar, Float64Var, and StringVar define new flags referencing
// a given pointer, like the functions of the same name in package flag.
BoolVar(pointer *bool, name string, def bool, usage string)
IntVar(pointer *int, name string, def int, usage string)
Float64Var(pointer *float64, name string, def float64, usage string)
StringVar(pointer *string, name string, def string, usage string)

// StringList is similar to String but allows multiple values for a
// single flag
StringList(name string, def string, usage string) *[]*string
Expand Down
32 changes: 0 additions & 32 deletions internal/driver/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,38 +330,6 @@ func (f testFlags) String(s, d, c string) *string {
return &d
}

func (f testFlags) BoolVar(p *bool, s string, d bool, c string) {
if b, ok := f.bools[s]; ok {
*p = b
} else {
*p = d
}
}

func (f testFlags) IntVar(p *int, s string, d int, c string) {
if i, ok := f.ints[s]; ok {
*p = i
} else {
*p = d
}
}

func (f testFlags) Float64Var(p *float64, s string, d float64, c string) {
if g, ok := f.floats[s]; ok {
*p = g
} else {
*p = d
}
}

func (f testFlags) StringVar(p *string, s, d, c string) {
if t, ok := f.strings[s]; ok {
*p = t
} else {
*p = d
}
}

func (f testFlags) StringList(s, d, c string) *[]*string {
if t, ok := f.stringLists[s]; ok {
// convert slice of strings to slice of string pointers before returning.
Expand Down
21 changes: 0 additions & 21 deletions internal/driver/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,6 @@ func (*GoFlags) String(o, d, c string) *string {
return flag.String(o, d, c)
}

// BoolVar implements the plugin.FlagSet interface.
func (*GoFlags) BoolVar(b *bool, o string, d bool, c string) {
flag.BoolVar(b, o, d, c)
}

// IntVar implements the plugin.FlagSet interface.
func (*GoFlags) IntVar(i *int, o string, d int, c string) {
flag.IntVar(i, o, d, c)
}

// Float64Var implements the plugin.FlagSet interface.
// the value of the flag.
func (*GoFlags) Float64Var(f *float64, o string, d float64, c string) {
flag.Float64Var(f, o, d, c)
}

// StringVar implements the plugin.FlagSet interface.
func (*GoFlags) StringVar(s *string, o, d, c string) {
flag.StringVar(s, o, d, c)
}

// StringList implements the plugin.FlagSet interface.
func (*GoFlags) StringList(o, d, c string) *[]*string {
return &[]*string{flag.String(o, d, c)}
Expand Down
7 changes: 0 additions & 7 deletions internal/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,6 @@ type FlagSet interface {
Float64(name string, def float64, usage string) *float64
String(name string, def string, usage string) *string

// BoolVar, IntVar, Float64Var, and StringVar define new flags referencing
// a given pointer, like the functions of the same name in package flag.
BoolVar(pointer *bool, name string, def bool, usage string)
IntVar(pointer *int, name string, def int, usage string)
Float64Var(pointer *float64, name string, def float64, usage string)
StringVar(pointer *string, name string, def string, usage string)

// StringList is similar to String but allows multiple values for a
// single flag
StringList(name string, def string, usage string) *[]*string
Expand Down