Skip to content

Commit 99efe7c

Browse files
qiulaidongfenggopherbot
authored andcommitted
cmd/internal/moddeps: fix test fail when the last element of GOROOT start with a dot or underscore
Fixes #54221 Change-Id: Id16f553251daf0b7c51f45232a4133f7dfb1ebb9 GitHub-Last-Rev: 675c2bf GitHub-Pull-Request: #65298 Reviewed-on: https://go-review.googlesource.com/c/go/+/558696 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com>
1 parent 09b5de4 commit 99efe7c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cmd/internal/moddeps/moddeps_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ func findGorootModules(t *testing.T) []gorootModule {
454454
if err != nil {
455455
return err
456456
}
457-
if info.IsDir() && (info.Name() == "vendor" || info.Name() == "testdata") {
457+
if info.IsDir() && path != root && (info.Name() == "vendor" || info.Name() == "testdata") {
458458
return filepath.SkipDir
459459
}
460460
if info.IsDir() && path == filepath.Join(testenv.GOROOT(t), "pkg") {
@@ -465,7 +465,7 @@ func findGorootModules(t *testing.T) []gorootModule {
465465
// running time of this test anyway.)
466466
return filepath.SkipDir
467467
}
468-
if info.IsDir() && (strings.HasPrefix(info.Name(), "_") || strings.HasPrefix(info.Name(), ".")) {
468+
if info.IsDir() && path != root && (strings.HasPrefix(info.Name(), "_") || strings.HasPrefix(info.Name(), ".")) {
469469
// _ and . prefixed directories can be used for internal modules
470470
// without a vendor directory that don't contribute to the build
471471
// but might be used for example as code generators.

0 commit comments

Comments
 (0)