aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2024-10-02 13:00:17 +0200
committerGopher Robot <gobot@golang.org>2024-10-02 14:22:59 +0000
commitbb5339196f86057ffa6042d31f52a44bf7f13752 (patch)
tree20b17a10fceb171501e121b0ace7d95f532e69cd /src/testing
parente86982c515ba4a494fb1f8e1367f4238a2b59c2e (diff)
downloadgo-bb5339196f86057ffa6042d31f52a44bf7f13752.tar.xz
all: use slices.Sorted(maps.Keys(m))
Use slices.Sorted(maps.Keys(m)) to get a sorted slices of the keys in a map. Do not change packages built during bootstrap, as the bootstrap compiler (currently 1.22.6) does not have the required maps and slices functions. Change-Id: Ie35565d241fa14aca56b730a69af010127b659ab Reviewed-on: https://go-review.googlesource.com/c/go/+/617356 Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/fstest/testfs.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/testing/fstest/testfs.go b/src/testing/fstest/testfs.go
index 76a2cff62d..2917a303b2 100644
--- a/src/testing/fstest/testfs.go
+++ b/src/testing/fstest/testfs.go
@@ -10,6 +10,7 @@ import (
"fmt"
"io"
"io/fs"
+ "maps"
"path"
"slices"
"strings"
@@ -71,13 +72,7 @@ func testFS(fsys fs.FS, expected ...string) error {
}
delete(found, ".")
if len(expected) == 0 && len(found) > 0 {
- var list []string
- for k := range found {
- if k != "." {
- list = append(list, k)
- }
- }
- slices.Sort(list)
+ list := slices.Sorted(maps.Keys(found))
if len(list) > 15 {
list = append(list[:10], "...")
}