aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorqiulaidongfeng <2645477756@qq.com>2024-01-27 03:27:17 +0000
committerGopher Robot <gobot@golang.org>2024-01-27 03:54:16 +0000
commit99efe7c39e80b92511bb06153da4d4d8db6138a6 (patch)
tree3d17859ffb7730599ee0012e8b5a217ae4ee1eca /src
parent09b5de48e64e67db92b31eaca054c5d096e3c057 (diff)
downloadgo-99efe7c39e80b92511bb06153da4d4d8db6138a6.tar.xz
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: 675c2bfcbb4fd31da0442dd0e612874934cc0d87 GitHub-Pull-Request: golang/go#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>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/internal/moddeps/moddeps_test.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/internal/moddeps/moddeps_test.go b/src/cmd/internal/moddeps/moddeps_test.go
index 3d4c99eecb..f9693a4954 100644
--- a/src/cmd/internal/moddeps/moddeps_test.go
+++ b/src/cmd/internal/moddeps/moddeps_test.go
@@ -454,7 +454,7 @@ func findGorootModules(t *testing.T) []gorootModule {
if err != nil {
return err
}
- if info.IsDir() && (info.Name() == "vendor" || info.Name() == "testdata") {
+ if info.IsDir() && path != root && (info.Name() == "vendor" || info.Name() == "testdata") {
return filepath.SkipDir
}
if info.IsDir() && path == filepath.Join(testenv.GOROOT(t), "pkg") {
@@ -465,7 +465,7 @@ func findGorootModules(t *testing.T) []gorootModule {
// running time of this test anyway.)
return filepath.SkipDir
}
- if info.IsDir() && (strings.HasPrefix(info.Name(), "_") || strings.HasPrefix(info.Name(), ".")) {
+ if info.IsDir() && path != root && (strings.HasPrefix(info.Name(), "_") || strings.HasPrefix(info.Name(), ".")) {
// _ and . prefixed directories can be used for internal modules
// without a vendor directory that don't contribute to the build
// but might be used for example as code generators.