mirror of
https://github.com/golang/go
synced 2024-11-23 18:50:05 -07:00
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>
This commit is contained in:
parent
827a7a9224
commit
f9197a7043
11
src/run.bash
11
src/run.bash
@ -16,8 +16,13 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
eval $(go env)
|
if [ ! -f ../bin/go ]; then
|
||||||
export GOROOT # the api test requires GOROOT to be set.
|
echo 'run.bash must be run from $GOROOT/src after installing cmd/go' 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval $(../bin/go env)
|
||||||
|
export GOROOT # The api test requires GOROOT to be set, so set it to match ../bin/go.
|
||||||
|
|
||||||
# We disallow local import for non-local packages, if $GOROOT happens
|
# 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 under $GOPATH, then some tests below will fail. $GOPATH needs
|
||||||
@ -56,4 +61,4 @@ if ulimit -T &> /dev/null; then
|
|||||||
[ "$(ulimit -H -T)" = "unlimited" ] || ulimit -S -T $(ulimit -H -T)
|
[ "$(ulimit -H -T)" = "unlimited" ] || ulimit -S -T $(ulimit -H -T)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec go tool dist test -rebuild "$@"
|
exec ../bin/go tool dist test -rebuild "$@"
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
|
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
if exist ..\bin\go goto ok
|
||||||
|
echo Must run run.bat from Go src directory after installing cmd/go.
|
||||||
|
goto fail
|
||||||
|
:ok
|
||||||
|
|
||||||
:: Keep environment variables within this script
|
:: Keep environment variables within this script
|
||||||
:: unless invoked with --no-local.
|
:: unless invoked with --no-local.
|
||||||
if x%1==x--no-local goto nolocal
|
if x%1==x--no-local goto nolocal
|
||||||
@ -36,13 +41,13 @@ echo.
|
|||||||
set GOROOT_FINAL=
|
set GOROOT_FINAL=
|
||||||
|
|
||||||
:: get CGO_ENABLED
|
:: get CGO_ENABLED
|
||||||
go env > env.bat
|
..\bin\go env > env.bat
|
||||||
if errorlevel 1 goto fail
|
if errorlevel 1 goto fail
|
||||||
call env.bat
|
call env.bat
|
||||||
del env.bat
|
del env.bat
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
go tool dist test
|
..\bin\go tool dist test
|
||||||
if errorlevel 1 goto fail
|
if errorlevel 1 goto fail
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
|
@ -5,7 +5,12 @@
|
|||||||
|
|
||||||
rfork e
|
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
|
GOPATH = () # we disallow local import for non-local packages, if $GOROOT happens
|
||||||
# to be under $GOPATH, then some tests below will fail
|
# to be under $GOPATH, then some tests below will fail
|
||||||
@ -13,4 +18,4 @@ GOBIN = () # Issue 14340
|
|||||||
GOFLAGS = ()
|
GOFLAGS = ()
|
||||||
GO111MODULE = ()
|
GO111MODULE = ()
|
||||||
|
|
||||||
exec go tool dist test -rebuild $*
|
exec ../bin/go tool dist test -rebuild $*
|
||||||
|
Loading…
Reference in New Issue
Block a user