]> Cypherpunks repositories - gostls13.git/commitdiff
maps, slices: fix variable name and comment in example
authorcuishuang <imcusg@gmail.com>
Wed, 14 Aug 2024 07:33:00 +0000 (15:33 +0800)
committerGopher Robot <gobot@golang.org>
Wed, 14 Aug 2024 18:28:34 +0000 (18:28 +0000)
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>
src/maps/example_test.go
src/slices/example_test.go

index c1000d4d9d7e6cc262d56083a6409a9d5e78ed05..0795941d9064bf0bed2fbf3654013c9b721748bb 100644 (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]
 }
index fb93f6e79f589435a580bacc1dc45aa5d5c297de..305745e88305048f9eafe2199a4b2a05e4ead53b 100644 (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)
        })