Skip to content

Commit bcfaf2f

Browse files
ianlancetaylorgopherbot
authored andcommitted
slices: use strings.EqualFold in ExampleCompactFunc
Change-Id: Ie7d495b2a53520ce89b16bc8a66b81a3955bf32f Reviewed-on: https://go-review.googlesource.com/c/go/+/530635 Reviewed-by: Eli Bendersky <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 9f8f1ca commit bcfaf2f

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/slices/example_test.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ func ExampleCompact() {
5151

5252
func ExampleCompactFunc() {
5353
names := []string{"bob", "Bob", "alice", "Vera", "VERA"}
54-
names = slices.CompactFunc(names, func(a, b string) bool {
55-
return strings.ToLower(a) == strings.ToLower(b)
56-
})
54+
names = slices.CompactFunc(names, strings.EqualFold)
5755
fmt.Println(names)
5856
// Output:
5957
// [bob alice Vera]

0 commit comments

Comments
 (0)