From 9ca2474fd274d7bce8da454d1a7da074e40944ad Mon Sep 17 00:00:00 2001 From: Fazlul Shahriar Date: Mon, 15 Jun 2020 13:04:05 -0400 Subject: [PATCH] cmd/go: fix mod_gomodcache and generate_env TestScripts on Plan 9 Adjust these two tests for Plan 9, which uses $path instead of $PATH, and $home instead of $HOME. Fixes #39599 Change-Id: Idba95e07d307e76f0f61acd904905b417c52d43a Reviewed-on: https://go-review.googlesource.com/c/go/+/237941 Reviewed-by: Bryan C. Mills Run-TryBot: Bryan C. Mills TryBot-Result: Gobot Gobot --- src/cmd/go/testdata/script/generate_env.txt | 3 ++- src/cmd/go/testdata/script/mod_gomodcache.txt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cmd/go/testdata/script/generate_env.txt b/src/cmd/go/testdata/script/generate_env.txt index 0d3693fa33a..2df16633765 100644 --- a/src/cmd/go/testdata/script/generate_env.txt +++ b/src/cmd/go/testdata/script/generate_env.txt @@ -1,7 +1,8 @@ # Install an env command because Windows and plan9 don't have it. env GOBIN=$WORK/tmp/bin go install env.go -env PATH=$GOBIN${:}$PATH +[plan9] env path=$GOBIN${:}$path +[!plan9] env PATH=$GOBIN${:}$PATH # Test generators have access to the environment go generate ./printenv.go diff --git a/src/cmd/go/testdata/script/mod_gomodcache.txt b/src/cmd/go/testdata/script/mod_gomodcache.txt index 67a8f07b2ce..b2143e20939 100644 --- a/src/cmd/go/testdata/script/mod_gomodcache.txt +++ b/src/cmd/go/testdata/script/mod_gomodcache.txt @@ -24,7 +24,8 @@ grep '{"Version":"v1.0.0","Time":"2018-02-14T00:45:20Z"}' $GOPATH/pkg/mod/cache/ # If neither GOMODCACHE or GOPATH are set, GOPATH defaults to the user's $HOME/go, so GOMODCACHE becomes $HOME/go/pkg/mod [windows] env USERPROFILE=$WORK/home # Ensure USERPROFILE is a valid path (rather than /no-home/ so we don't run into the logic that "uninfers" GOPATH in cmd/go/main.go -[!windows] env HOME=$WORK/home +[plan9] env home=$WORK/home +[!windows] [!plan9] env HOME=$WORK/home env GOMODCACHE= env GOPATH= go env GOMODCACHE