]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/moddeps: skip GOROOT/pkg when locating modules
authorBryan C. Mills <bcmills@google.com>
Wed, 18 Mar 2020 17:50:14 +0000 (13:50 -0400)
committerBryan C. Mills <bcmills@google.com>
Wed, 18 Mar 2020 18:12:40 +0000 (18:12 +0000)
Fixes #37929

Change-Id: I1435411de43aed98f40e0d98e450310b0fdf804c
Reviewed-on: https://go-review.googlesource.com/c/go/+/223924
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/internal/moddeps/moddeps_test.go

index b6fd92438e21653bba7fe800d042290dc00c82b1..5d73edd318f7c59203e892261607ccaf3052a4c9 100644 (file)
@@ -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
                        }