Commit de63c93836 for golang
commit de63c93836391097f791fce054493fc21268ebac
Author: Alan Donovan <adonovan@google.com>
Date: Fri Dec 4 15:59:20 2026 -0500
cmd/go: run the go.vet overlay tests on Windows
test_vet_goroot and test_vetfiles_std build an overlay JSON file
by echoing $GOROOT and $WORK, which contain backslashes on Windows,
producing invalid JSON. Escape the backslashes with the script
replace command, and remove the Windows skip from test_vet_goroot.
This fixes test_vetfiles_std.txt, broken by CL 856984.
For #82464
Change-Id: I668f8c640615f6af51fa7a42e15923beb90ea0f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/870322
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Neal Patel <nealpatel@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Neal Patel <neal@golang.org>
Reviewed-by: David Chase <drchase@google.com>
diff --git a/src/cmd/go/testdata/script/test_vet_goroot.txt b/src/cmd/go/testdata/script/test_vet_goroot.txt
index 0595b1f2df..f09b362062 100644
--- a/src/cmd/go/testdata/script/test_vet_goroot.txt
+++ b/src/cmd/go/testdata/script/test_vet_goroot.txt
@@ -9,7 +9,6 @@
[short] skip 'builds and analyzes standard packages'
[!compiler:gc] skip
-[GOOS:windows] skip 'the overlay JSON would need escaped backslashes'
env GOEXPERIMENT=vetfiles
@@ -18,6 +17,7 @@ env GOEXPERIMENT=vetfiles
# found by bools, which is in the default set.
echo {"Replace":{"$GOROOT/src/strings/zz_test.go":"$WORK/gopath/src/xtest.go","$GOROOT/src/vendor/golang.org/x/net/http/httpguts/zz.go":"$WORK/gopath/src/stdvendor.go"}}
cp stdout overlay.json
+replace '\\' '\\\\' overlay.json # escape Windows backslashes
# An external test package of std.
! go test -overlay=overlay.json -run=^$ strings
diff --git a/src/cmd/go/testdata/script/test_vetfiles_std.txt b/src/cmd/go/testdata/script/test_vetfiles_std.txt
index d8ee16fbf2..a75453b99f 100644
--- a/src/cmd/go/testdata/script/test_vetfiles_std.txt
+++ b/src/cmd/go/testdata/script/test_vetfiles_std.txt
@@ -11,6 +11,7 @@ env GOEXPERIMENT=vetfiles
echo {"Replace":{"$GOROOT/src/fmt/go.vet":"$WORK/gopath/src/fmt_go.vet","$GOROOT/src/internal/zzcheck/zzcheck.go":"$WORK/gopath/src/zzcheck.go","$GOROOT/src/fmt/zzpublic/zzpublic.go":"$WORK/gopath/src/zzpublic.go"}}
cp stdout overlay.json
+replace '\\' '\\\\' overlay.json # escape Windows backslashes
# A "." declaration in std applies to the std package itself.
# (The analyzer is in an internal package of std, which fmt can see.)