aboutsummaryrefslogtreecommitdiff
path: root/src/run.rc
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2020-03-17 10:22:39 -0400
committerBryan C. Mills <bcmills@google.com>2020-03-27 15:43:51 +0000
commitf9197a7043e48b6d2caa5ea1b0a969495f998d48 (patch)
treef8740ef8357c60083161cc9488da757cd120e108 /src/run.rc
parent827a7a92248b9e1b67659bb2257e83e3a7e40d2d (diff)
downloadgo-f9197a7043e48b6d2caa5ea1b0a969495f998d48.tar.gz
go-f9197a7043e48b6d2caa5ea1b0a969495f998d48.zip
run.{bash,bat,rc}: use ../bin/go instead of the go binary in $PATH
https://golang.org/doc/contribute.html#quick_test currently suggests running 'make.bash' and 'run.bash' separately, but 'run.bash' potentially uses a 'go' command resolved from the wrong GOROOT, which in turn sets the wrong GOROOT for further commands. Updates #32674 Updates #17896 Change-Id: I4925d478d0fc7351c4f6d40830ab17d4d688348d Reviewed-on: https://go-review.googlesource.com/c/go/+/223741 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
Diffstat (limited to 'src/run.rc')
-rwxr-xr-xsrc/run.rc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/run.rc b/src/run.rc
index c346f5cf5c..ab7abfa991 100755
--- a/src/run.rc
+++ b/src/run.rc
@@ -5,7 +5,12 @@
rfork e
-eval `{go env}
+if(! test -f ../bin/go){
+ echo 'run.rc must be run from $GOROOT/src after installing cmd/go' >[1=2]
+ exit wrongdir
+}
+
+eval `{../bin/go env}
GOPATH = () # we disallow local import for non-local packages, if $GOROOT happens
# to be under $GOPATH, then some tests below will fail
@@ -13,4 +18,4 @@ GOBIN = () # Issue 14340
GOFLAGS = ()
GO111MODULE = ()
-exec go tool dist test -rebuild $*
+exec ../bin/go tool dist test -rebuild $*