1
0
mirror of https://github.com/golang/go synced 2024-11-22 05:24:39 -07:00

maps, slices: fix variable name and comment in example

Change-Id: I1c837820bdd64b61fca46d45677664b2bb2be606
Reviewed-on: https://go-review.googlesource.com/c/go/+/605356
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
cuishuang 2024-08-14 15:33:00 +08:00 committed by Gopher Robot
parent 65a6e05070
commit 0f1db95414
2 changed files with 3 additions and 3 deletions

View File

@ -167,8 +167,8 @@ func ExampleValues() {
10: "Ten",
1000: "THOUSAND",
}
keys := slices.Sorted(maps.Values(m1))
fmt.Println(keys)
values := slices.Sorted(maps.Values(m1))
fmt.Println(values)
// Output:
// [THOUSAND Ten one]
}

View File

@ -310,7 +310,7 @@ func ExampleSortStableFunc() {
{"Bob", 24},
{"Alice", 55},
}
// Stable sort by name, keeping age ordering of Alices intact
// Stable sort by name, keeping age ordering of Alice intact
slices.SortStableFunc(people, func(a, b Person) int {
return strings.Compare(a.Name, b.Name)
})