]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: fix TestScript/vet_flags
authorRuss Cox <rsc@golang.org>
Wed, 5 Nov 2025 18:49:48 +0000 (13:49 -0500)
committerGopher Robot <gobot@golang.org>
Wed, 5 Nov 2025 20:30:31 +0000 (12:30 -0800)
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>

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

index 21606dc4f1dfc83b45093c5132d6cb5f2f6f48a4..e274dbedb39bd87fb3286894a6e9143b1cb78ca3 100644 (file)
@@ -20,7 +20,8 @@ stderr '-unsafeptr'
 ! stderr '-unsafeptr=false'
 
 # -unreachable is disabled during test but on during plain vet.
-go test -n runtime
+# The -a makes sure the vet result is not cached, or else we won't print the command line.
+go test -a -n runtime
 stderr '-unreachable=false'
 
 # A flag terminator should be allowed before the package list.
@@ -63,16 +64,16 @@ go test -n -vet= -run=none .
 stderr '[/\\]vet'$GOEXE'["]? .* -errorsas .* ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
 
 # "go test" on a standard package should by default disable an explicit list.
-go test -n -run=none encoding/binary
+go test -a -n -run=none encoding/binary
 stderr '[/\\]vet'$GOEXE'["]? -unsafeptr=false -unreachable=false ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
 
-go test -n -vet= -run=none encoding/binary
+go test -a -n -vet= -run=none encoding/binary
 stderr '[/\\]vet'$GOEXE'["]? -unsafeptr=false -unreachable=false ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
 
 # Both should allow users to override via the -vet flag.
-go test -n -vet=unreachable -run=none .
+go test -a -n -vet=unreachable -run=none .
 stderr '[/\\]vet'$GOEXE'["]? -unreachable ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
-go test -n -vet=unreachable -run=none encoding/binary
+go test -a -n -vet=unreachable -run=none encoding/binary
 stderr '[/\\]vet'$GOEXE'["]? -unreachable ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
 
 -- go.mod --