Skip to content

Commit a494a26

Browse files
rscgopherbot
authored andcommitted
cmd/go: fix TestScript/vet_flags
Test caching can cause an incorrect test failure when the vet step result is reused, leading to not printing a vet command line at all. Avoid that with -a (we are also using -n so no real work is done). Fixes one failing case in 'go test cmd/go' on my Mac. Change-Id: I028284436b1ecc77145c886db902845b524f4b97 Reviewed-on: https://go-review.googlesource.com/c/go/+/718181 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Michael Matloob <matloob@google.com> Auto-Submit: Russ Cox <rsc@golang.org>
1 parent a8fb949 commit a494a26

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/cmd/go/testdata/script/vet_flags.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ stderr '-unsafeptr'
2020
! stderr '-unsafeptr=false'
2121

2222
# -unreachable is disabled during test but on during plain vet.
23-
go test -n runtime
23+
# The -a makes sure the vet result is not cached, or else we won't print the command line.
24+
go test -a -n runtime
2425
stderr '-unreachable=false'
2526

2627
# A flag terminator should be allowed before the package list.
@@ -63,16 +64,16 @@ go test -n -vet= -run=none .
6364
stderr '[/\\]vet'$GOEXE'["]? .* -errorsas .* ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
6465

6566
# "go test" on a standard package should by default disable an explicit list.
66-
go test -n -run=none encoding/binary
67+
go test -a -n -run=none encoding/binary
6768
stderr '[/\\]vet'$GOEXE'["]? -unsafeptr=false -unreachable=false ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
6869

69-
go test -n -vet= -run=none encoding/binary
70+
go test -a -n -vet= -run=none encoding/binary
7071
stderr '[/\\]vet'$GOEXE'["]? -unsafeptr=false -unreachable=false ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
7172

7273
# Both should allow users to override via the -vet flag.
73-
go test -n -vet=unreachable -run=none .
74+
go test -a -n -vet=unreachable -run=none .
7475
stderr '[/\\]vet'$GOEXE'["]? -unreachable ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
75-
go test -n -vet=unreachable -run=none encoding/binary
76+
go test -a -n -vet=unreachable -run=none encoding/binary
7677
stderr '[/\\]vet'$GOEXE'["]? -unreachable ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
7778

7879
-- go.mod --

0 commit comments

Comments
 (0)