Skip to content

Commit

Permalink
more linting
Browse files Browse the repository at this point in the history
Signed-off-by: Frederic BIDON <[email protected]>
  • Loading branch information
fredbi committed Nov 6, 2020
1 parent f44a748 commit 8f6b77f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions flag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ func TestShorthandLookup(t *testing.T) {
flag := f.ShorthandLookup("a")
if flag == nil {
t.Errorf("f.ShorthandLookup(\"a\") returned nil")
return // required
}
if flag.Name != "boola" {
t.Errorf("f.ShorthandLookup(\"a\") found %q instead of \"boola\"", flag.Name)
Expand Down
5 changes: 1 addition & 4 deletions ipnet_slice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ func getCIDR(ip net.IP, cidr *net.IPNet, err error) net.IPNet {
}

func equalCIDR(c1 net.IPNet, c2 net.IPNet) bool {
if c1.String() == c2.String() {
return true
}
return false
return c1.String() == c2.String()
}

func setUpIPNetFlagSet(ipsp *[]net.IPNet) *FlagSet {
Expand Down
7 changes: 4 additions & 3 deletions string_array.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ func (s *stringArrayValue) Append(val string) error {

func (s *stringArrayValue) Replace(val []string) error {
out := make([]string, len(val))
for i, d := range val {
out[i] = d
}
copy(out, val)
*s.value = out
return nil
}
Expand All @@ -53,6 +51,9 @@ func (s *stringArrayValue) String() string {
}

func stringArrayConv(sval string) (interface{}, error) {
if len(sval) == 0 {
return []string{}, nil
}
sval = sval[1 : len(sval)-1]
// An empty string would cause a array with one (empty) string
if len(sval) == 0 {
Expand Down
7 changes: 7 additions & 0 deletions string_array_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,3 +254,10 @@ func TestSAWithSquareBrackets(t *testing.T) {
}
}
}

func TestStringArrayConv(t *testing.T) {
_, err := stringArrayConv("")
if err != nil {
t.Errorf("unexpected failure on stringArrayConv")
}
}

0 comments on commit 8f6b77f

Please sign in to comment.