From: Robert Griesemer Date: Mon, 21 Mar 2022 21:37:38 +0000 (-0700) Subject: cmd/gofmt: don't descend into /testdata directories in tests (fix long builders) X-Git-Tag: go1.19beta1~969 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=4b6debaf2894757e7ae9ad31f52f6a1279c94e90;p=gostls13.git 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 --- 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++ }