From 3b76bed3cdd865d9aabaa8e42eac72dc61e067db Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Wed, 18 Mar 2020 13:50:14 -0400 Subject: [PATCH] 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 Reviewed-by: Dmitri Shuralyov TryBot-Result: Gobot Gobot --- src/cmd/internal/moddeps/moddeps_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/cmd/internal/moddeps/moddeps_test.go b/src/cmd/internal/moddeps/moddeps_test.go index b6fd92438e..5d73edd318 100644 --- a/src/cmd/internal/moddeps/moddeps_test.go +++ b/src/cmd/internal/moddeps/moddeps_test.go @@ -39,6 +39,14 @@ func findGorootModules(t *testing.T) []gorootModule { if info.Name() == "vendor" || info.Name() == "testdata" { return filepath.SkipDir } + if path == filepath.Join(runtime.GOROOT(), "pkg") { + // GOROOT/pkg contains generated artifacts, not source code. + // + // In https://golang.org/issue/37929 it was observed to somehow contain + // a module cache, so it is important to skip. (That helps with the + // running time of this test anyway.) + return filepath.SkipDir + } if info.IsDir() || info.Name() != "go.mod" { return nil } -- 2.50.0