diff options
| -rw-r--r-- | flag.go | 2 | ||||
| -rw-r--r-- | flag_test.go | 8 | ||||
| -rw-r--r-- | golangflag.go | 3 | ||||
| -rw-r--r-- | ip.go | 2 | ||||
| -rw-r--r-- | ipnet.go | 2 | ||||
| -rw-r--r-- | string_array.go | 6 | ||||
| -rw-r--r-- | string_slice.go | 5 |
7 files changed, 6 insertions, 22 deletions
@@ -635,7 +635,7 @@ func (f *FlagSet) VarPF(value Value, name, shorthand, usage string) *Flag { // VarP is like Var, but accepts a shorthand letter that can be used after a single dash. func (f *FlagSet) VarP(value Value, name, shorthand, usage string) { - _ = f.VarPF(value, name, shorthand, usage) + f.VarPF(value, name, shorthand, usage) } // AddFlag will add the flag to the FlagSet diff --git a/flag_test.go b/flag_test.go index ad050b3..b83a0ed 100644 --- a/flag_test.go +++ b/flag_test.go @@ -462,10 +462,10 @@ func TestFlagSetParse(t *testing.T) { func TestChangedHelper(t *testing.T) { f := NewFlagSet("changedtest", ContinueOnError) - _ = f.Bool("changed", false, "changed bool") - _ = f.Bool("settrue", true, "true to true") - _ = f.Bool("setfalse", false, "false to false") - _ = f.Bool("unchanged", false, "unchanged bool") + f.Bool("changed", false, "changed bool") + f.Bool("settrue", true, "true to true") + f.Bool("setfalse", false, "false to false") + f.Bool("unchanged", false, "unchanged bool") args := []string{"--changed", "--settrue", "--setfalse=false"} if err := f.Parse(args); err != nil { diff --git a/golangflag.go b/golangflag.go index b056147..c4f47eb 100644 --- a/golangflag.go +++ b/golangflag.go @@ -6,13 +6,10 @@ package pflag import ( goflag "flag" - "fmt" "reflect" "strings" ) -var _ = fmt.Print - // flagValueWrapper implements pflag.Value around a flag.Value. The main // difference here is the addition of the Type method that returns a string // name of the type. As this is generally unknown, we approximate that with @@ -6,8 +6,6 @@ import ( "strings" ) -var _ = strings.TrimSpace - // -- net.IP value type ipValue net.IP @@ -27,8 +27,6 @@ func (*ipNetValue) Type() string { return "ipNet" } -var _ = strings.TrimSpace - func newIPNetValue(val net.IPNet, p *net.IPNet) *ipNetValue { *p = val return (*ipNetValue)(p) diff --git a/string_array.go b/string_array.go index 93b4e43..276b7ed 100644 --- a/string_array.go +++ b/string_array.go @@ -1,11 +1,5 @@ package pflag -import ( - "fmt" -) - -var _ = fmt.Fprint - // -- stringArray Value type stringArrayValue struct { value *[]string diff --git a/string_slice.go b/string_slice.go index 7829cfa..05eee75 100644 --- a/string_slice.go +++ b/string_slice.go @@ -3,12 +3,9 @@ package pflag import ( "bytes" "encoding/csv" - "fmt" "strings" ) -var _ = fmt.Fprint - // -- stringSlice Value type stringSliceValue struct { value *[]string @@ -39,7 +36,7 @@ func writeAsCSV(vals []string) (string, error) { return "", err } w.Flush() - return strings.TrimSuffix(b.String(), fmt.Sprintln()), nil + return strings.TrimSuffix(b.String(), "\n"), nil } func (s *stringSliceValue) Set(val string) error { |
