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