Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 <eliben@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
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

Lines changed: 1 addition & 3 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /