set -e
-eval $(go env)
-export GOROOT # the api test requires GOROOT to be set.
+if [ ! -f ../bin/go ]; then
+ 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
# to be under $GOPATH, then some tests below will fail. $GOPATH needs
[ "$(ulimit -H -T)" = "unlimited" ] || ulimit -S -T $(ulimit -H -T)
fi
-exec go tool dist test -rebuild "$@"
+exec ../bin/go tool dist test -rebuild "$@"
@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
:: unless invoked with --no-local.
if x%1==x--no-local goto nolocal
set GOROOT_FINAL=
:: get CGO_ENABLED
-go env > env.bat
+..\bin\go env > env.bat
if errorlevel 1 goto fail
call env.bat
del env.bat
echo.
-go tool dist test
+..\bin\go tool dist test
if errorlevel 1 goto fail
echo.
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
GOFLAGS = ()
GO111MODULE = ()
-exec go tool dist test -rebuild $*
+exec ../bin/go tool dist test -rebuild $*