From 9a44df66758c65e6f0b3ab0002a297d2fc266d7c Mon Sep 17 00:00:00 2001 From: Michael Matloob Date: Wed, 8 Jan 2025 11:19:05 -0500 Subject: [PATCH] cmd/go/testdata/script: fix TestScript/env_gocacheprog on Windows The backslashes on the windows paths will be escaped, so when checking for them in the regular expression we'd have to have quadruple backslashes '\\\\'. Since it's difficult to escape $GOCACHEPROG properly for both json and regexp, just check for a string that ends in cacheprog$GOEXE. We already check that the proper value is reported in go env and go env -changed, and the json test case is mostly useful to verify that GOCACHEPROG shows up in the json output. For #71059 Change-Id: I52d49de61f2309a139f84c4d232b4cd94546ec8c Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-linux-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/641375 Reviewed-by: Dmitri Shuralyov LUCI-TryBot-Result: Go LUCI Reviewed-by: Sam Thanawalla Reviewed-by: Dmitri Shuralyov --- src/cmd/go/testdata/script/env_gocacheprog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/go/testdata/script/env_gocacheprog.txt b/src/cmd/go/testdata/script/env_gocacheprog.txt index f5f15ed078..1547bf058c 100644 --- a/src/cmd/go/testdata/script/env_gocacheprog.txt +++ b/src/cmd/go/testdata/script/env_gocacheprog.txt @@ -24,7 +24,7 @@ go env -changed stdout 'GOCACHEPROG=''?'$GOCACHEPROG'''?' go env -changed -json -stdout '"GOCACHEPROG": "'$GOCACHEPROG'"' +stdout '"GOCACHEPROG": ".*cacheprog'$GOEXE'"' -- cacheprog.go -- // This is a minimal GOCACHEPROG program that can't actually do anything but exit. -- 2.48.1