Merge pull request #102 from bogem/redundant
Clean up code
diff --git a/flag.go b/flag.go
index b4bfecb..3f5fedd 100644
--- a/flag.go
+++ b/flag.go
@@ -635,7 +635,7 @@
// 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 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 @@
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
diff --git a/ip.go b/ip.go
index 88a1743..3d414ba 100644
--- a/ip.go
+++ b/ip.go
@@ -6,8 +6,6 @@
"strings"
)
-var _ = strings.TrimSpace
-
// -- net.IP value
type ipValue net.IP
diff --git a/ipnet.go b/ipnet.go
index 149b764..e2c1b8b 100644
--- a/ipnet.go
+++ b/ipnet.go
@@ -27,8 +27,6 @@
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 @@
import (
"bytes"
"encoding/csv"
- "fmt"
"strings"
)
-var _ = fmt.Fprint
-
// -- stringSlice Value
type stringSliceValue struct {
value *[]string
@@ -39,7 +36,7 @@
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 {