From e030833880b4ed20a7c153e6e58190c5649284ac Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Fri, 4 Mar 2022 17:17:56 -0500 Subject: [PATCH] cmd/compile/internal/syntax: don't try to parse files in GOROOT/.git This test was failing locally in my clone of the go repo due to a Git branch ending in ".go", which the test found and was attempting to parse as a file. It's fragile to try to parse .go files in GOROOT/.git, and wasteful to scan GOROOT/pkg and other non-source directories; instead, let's only parse the directories we actually expect to contain source files. (I was running the test for #51461.) Change-Id: I5d4e31ec2bcd9b4b6840ec32ad9b12bf44f349a5 Reviewed-on: https://go-review.googlesource.com/c/go/+/390023 Trust: Bryan Mills Run-TryBot: Bryan Mills TryBot-Result: Gopher Robot Reviewed-by: Robert Griesemer --- src/cmd/compile/internal/syntax/parser_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cmd/compile/internal/syntax/parser_test.go b/src/cmd/compile/internal/syntax/parser_test.go index e258a17c38..ecb21e070b 100644 --- a/src/cmd/compile/internal/syntax/parser_test.go +++ b/src/cmd/compile/internal/syntax/parser_test.go @@ -78,7 +78,8 @@ func TestStdLib(t *testing.T) { go func() { defer close(results) for _, dir := range []string{ - runtime.GOROOT(), + filepath.Join(runtime.GOROOT(), "src"), + filepath.Join(runtime.GOROOT(), "misc"), } { walkDirs(t, dir, func(filename string) { if skipRx != nil && skipRx.MatchString(filename) { -- 2.50.0