From a494a26bc2d0ad52e0e265c2a1b9a3a964118699 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 5 Nov 2025 13:49:48 -0500 Subject: [PATCH] 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 Reviewed-by: Michael Matloob Reviewed-by: Michael Matloob Auto-Submit: Russ Cox --- src/cmd/go/testdata/script/vet_flags.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cmd/go/testdata/script/vet_flags.txt b/src/cmd/go/testdata/script/vet_flags.txt index 21606dc4f1..e274dbedb3 100644 --- a/src/cmd/go/testdata/script/vet_flags.txt +++ b/src/cmd/go/testdata/script/vet_flags.txt @@ -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 -- -- 2.52.0