Skip to content

Commit 3b76bed

Browse files
author
Bryan C. Mills
committed
cmd/internal/moddeps: skip GOROOT/pkg when locating modules
Fixes #37929 Change-Id: I1435411de43aed98f40e0d98e450310b0fdf804c Reviewed-on: https://go-review.googlesource.com/c/go/+/223924 Run-TryBot: Bryan C. Mills <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 7cfb814 commit 3b76bed

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/cmd/internal/moddeps/moddeps_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ func findGorootModules(t *testing.T) []gorootModule {
3939
if info.Name() == "vendor" || info.Name() == "testdata" {
4040
return filepath.SkipDir
4141
}
42+
if path == filepath.Join(runtime.GOROOT(), "pkg") {
43+
// GOROOT/pkg contains generated artifacts, not source code.
44+
//
45+
// In https://golang.org/issue/37929 it was observed to somehow contain
46+
// a module cache, so it is important to skip. (That helps with the
47+
// running time of this test anyway.)
48+
return filepath.SkipDir
49+
}
4250
if info.IsDir() || info.Name() != "go.mod" {
4351
return nil
4452
}

0 commit comments

Comments
 (0)