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

Fix staticcheck findings #262

Merged
merged 1 commit into from
May 27, 2021
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
8 changes: 4 additions & 4 deletions cmp/compare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,8 +657,8 @@ func comparerTests() []test {
reason: "all zero map entries are ignored (even if missing)",
}, {
label: label + "/PanicUnexportedNamed",
x: namedWithUnexported{},
y: namedWithUnexported{},
x: namedWithUnexported{unexported: "x"},
y: namedWithUnexported{unexported: "y"},
wantPanic: strconv.Quote(reflect.TypeOf(namedWithUnexported{}).PkgPath()) + ".namedWithUnexported",
reason: "panic on named struct type with unexported field",
}, {
Expand Down Expand Up @@ -1279,11 +1279,11 @@ using the AllowUnexported option.`, "\n"),
}, {
label: label + "/LargeMapKey",
x: map[*[]byte]int{func() *[]byte {
b := make([]byte, 1<<20, 1<<20)
b := make([]byte, 1<<20)
return &b
}(): 0},
y: map[*[]byte]int{func() *[]byte {
b := make([]byte, 1<<20, 1<<20)
b := make([]byte, 1<<20)
return &b
}(): 0},
reason: "printing map keys should have some verbosity limit imposed",
Expand Down
8 changes: 4 additions & 4 deletions cmp/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ func ExampleOption_equalNaNs() {
return (math.IsNaN(x) && math.IsNaN(y)) || x == y
})

x := []float64{1.0, math.NaN(), math.E, -0.0, +0.0}
y := []float64{1.0, math.NaN(), math.E, -0.0, +0.0}
z := []float64{1.0, math.NaN(), math.Pi, -0.0, +0.0} // Pi constant instead of E
x := []float64{1.0, math.NaN(), math.E, 0.0}
y := []float64{1.0, math.NaN(), math.E, 0.0}
z := []float64{1.0, math.NaN(), math.Pi, 0.0} // Pi constant instead of E

fmt.Println(cmp.Equal(x, y, opt))
fmt.Println(cmp.Equal(y, z, opt))
Expand Down Expand Up @@ -216,7 +216,7 @@ func ExampleOption_sortedSlice() {
type otherString string

func (x otherString) Equal(y otherString) bool {
return strings.ToLower(string(x)) == strings.ToLower(string(y))
return strings.EqualFold(string(x), string(y))
}

// If the Equal method defined on a type is not suitable, the type can be
Expand Down