diff options
author | Sean Christopherson <sean.j.christopherson@intel.com> | 2017-02-22 06:56:26 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2017-02-24 18:18:30 +0000 |
commit | 2a0d7e24aad70e01a5a301b7e5248fc9adfb0e26 (patch) | |
tree | 54d616406b1f258a607da0eb8723e6cddaadf0ed /src/run.bash | |
parent | 1564817d8c941344caa14d14fac55f7e7b46055e (diff) | |
download | go-2a0d7e24aad70e01a5a301b7e5248fc9adfb0e26.tar.gz go-2a0d7e24aad70e01a5a301b7e5248fc9adfb0e26.zip |
run.bash: set GOPATH to $GOROOT/nil before running tests
Set $GOPATH to a semantically valid, non-empty string that cannot
conflict with $GOROOT to avoid false test failures that occur when
$GOROOT resides under $GOPATH. Unsetting GOPATH is no longer viable
as Go now defines a default $GOPATH that may conflict with $GOROOT.
Fixes #19237
Change-Id: I376a2ad3b18e9c4098211b988dde7e76bc4725d2
Reviewed-on: https://go-review.googlesource.com/37396
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/run.bash')
-rwxr-xr-x | src/run.bash | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/run.bash b/src/run.bash index 293b775efa..c0029c51f4 100755 --- a/src/run.bash +++ b/src/run.bash @@ -8,9 +8,17 @@ set -e eval $(go env) export GOROOT # the api test requires GOROOT to be set. +# We disallow local import for non-local packages, if $GOROOT happens +# to be under $GOPATH, then some tests below will fail. $GOPATH needs +# to be set to a non-empty string, else Go will set a default value +# that may also conflict with $GOROOT. The $GOPATH value doesn't need +# to point to an actual directory, it just needs to pass the semantic +# checks performed by Go. Use $GOROOT to define $GOPATH so that we +# don't blunder into a user-defined symbolic link. +GOPATH=$GOROOT/nonexistentpath +export GOPATH + unset CDPATH # in case user has it set -unset GOPATH # we disallow local import for non-local packages, if $GOROOT happens - # to be under $GOPATH, then some tests below will fail unset GOBIN # Issue 14340 export GOHOSTOS |