aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal
diff options
context:
space:
mode:
authorKir Kolyshkin <kolyshkin@gmail.com>2024-09-04 21:56:06 -0700
committerGopher Robot <gobot@golang.org>2024-09-06 13:26:35 +0000
commit46bccdebfaea94157b743beeb207aa5afd70e7a8 (patch)
tree2d31c250de25194fa2ad5e70332c4b96735fb940 /src/cmd/internal
parent29a3a39b613c542d043ca1fdb3d7f10ed669666d (diff)
downloadgo-46bccdebfaea94157b743beeb207aa5afd70e7a8.tar.xz
cmd/internal/testdir: use os.ReadDir
Change-Id: I9828c7c4f9c27efabf072ec1d83b3ce94c14cc0f Reviewed-on: https://go-review.googlesource.com/c/go/+/610817 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/cmd/internal')
-rw-r--r--src/cmd/internal/testdir/testdir_test.go11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/cmd/internal/testdir/testdir_test.go b/src/cmd/internal/testdir/testdir_test.go
index 86ebf7ded6..31cca41a13 100644
--- a/src/cmd/internal/testdir/testdir_test.go
+++ b/src/cmd/internal/testdir/testdir_test.go
@@ -162,22 +162,17 @@ func shardMatch(name string) bool {
}
func goFiles(t *testing.T, dir string) []string {
- f, err := os.Open(filepath.Join(testenv.GOROOT(t), "test", dir))
- if err != nil {
- t.Fatal(err)
- }
- dirnames, err := f.Readdirnames(-1)
- f.Close()
+ files, err := os.ReadDir(filepath.Join(testenv.GOROOT(t), "test", dir))
if err != nil {
t.Fatal(err)
}
names := []string{}
- for _, name := range dirnames {
+ for _, file := range files {
+ name := file.Name()
if !strings.HasPrefix(name, ".") && strings.HasSuffix(name, ".go") && shardMatch(name) {
names = append(names, name)
}
}
- sort.Strings(names)
return names
}