From 4b6debaf2894757e7ae9ad31f52f6a1279c94e90 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Mon, 21 Mar 2022 14:37:38 -0700 Subject: [PATCH] cmd/gofmt: don't descend into /testdata directories in tests (fix long builders) Now that the go/types and types2 test files end in .go we must avoid trying to format them as that won't work in general. Change-Id: I05fdd95a0d26cbe746f6d618b22b48dc1f1ea749 Reviewed-on: https://go-review.googlesource.com/c/go/+/394295 Trust: Robert Griesemer Reviewed-by: Robert Findley Run-TryBot: Robert Findley TryBot-Result: Gopher Robot --- src/cmd/gofmt/long_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cmd/gofmt/long_test.go b/src/cmd/gofmt/long_test.go index a130874048..2ee5174b96 100644 --- a/src/cmd/gofmt/long_test.go +++ b/src/cmd/gofmt/long_test.go @@ -114,7 +114,8 @@ func genFilenames(t *testing.T, filenames chan<- string) { t.Error(err) return nil } - if isGoFile(d) { + // don't descend into testdata directories + if isGoFile(d) && !strings.Contains(filepath.ToSlash(filename), "/testdata/") { filenames <- filename nfiles++ } -- 2.51.0