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 <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Robert Griesemer 2022-03-21 14:37:38 -07:00
parent 4a46e6e44c
commit 4b6debaf28
1 changed files with 2 additions and 1 deletions

View File

@ -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++
}