Skip to content

Commit

Permalink
build: default GOROOT_BOOTSTRAP in make.{bash,bat} error msg from 1.4…
Browse files Browse the repository at this point in the history
… to 1.17

Fixes golang#54301
  • Loading branch information
cuiweixie committed Aug 11, 2022
1 parent de95dca commit cd2bc60
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
11 changes: 6 additions & 5 deletions src/make.bash
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@
# timing information to this file. Useful for profiling where the
# time goes when these scripts run.
#
# GOROOT_BOOTSTRAP: A working Go tree >= Go 1.4 for bootstrap.
# GOROOT_BOOTSTRAP: A working Go tree >= Go 1.17 for bootstrap.
# If $GOROOT_BOOTSTRAP/bin/go is missing, $(go env GOROOT) is
# tried for all "go" in $PATH. $HOME/go1.4 by default.
# tried for all "go" in $PATH. $HOME/go1.4, $HOME/sdk/go1.17
# or $HOME/go1.17 by default.

set -e

Expand Down Expand Up @@ -172,7 +173,7 @@ IFS=$'\n'; for go_exe in $(type -ap go); do
done; unset IFS
if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/go." >&2
echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2
echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.17." >&2
exit 1
fi
# Get the exact bootstrap toolchain version to help with debugging.
Expand All @@ -185,7 +186,7 @@ if $verbose; then
fi
if [ "$GOROOT_BOOTSTRAP" = "$GOROOT" ]; then
echo "ERROR: \$GOROOT_BOOTSTRAP must not be set to \$GOROOT" >&2
echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2
echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.17." >&2
exit 1
fi
rm -f cmd/dist/dist
Expand Down Expand Up @@ -213,7 +214,7 @@ fi

# Run dist bootstrap to complete make.bash.
# Bootstrap installs a proper cmd/dist, built with the new toolchain.
# Throw ours, built with Go 1.4, away after bootstrap.
# Throw ours, built with Go 1.17, away after bootstrap.
./cmd/dist/dist bootstrap -a $vflag $GO_DISTFLAGS "$@"
rm -f ./cmd/dist/dist

Expand Down
4 changes: 2 additions & 2 deletions src/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ if x%4==x--no-banner set bootstrapflags=%bootstrapflags% --no-banner

:: Run dist bootstrap to complete make.bash.
:: Bootstrap installs a proper cmd/dist, built with the new toolchain.
:: Throw ours, built with Go 1.4, away after bootstrap.
:: Throw ours, built with Go 1.17, away after bootstrap.
.\cmd\dist\dist.exe bootstrap -a %vflag% %bootstrapflags%
if errorlevel 1 goto fail
del .\cmd\dist\dist.exe
Expand All @@ -147,7 +147,7 @@ goto end

:bootstrapfail
echo ERROR: Cannot find %GOROOT_BOOTSTRAP%\bin\go.exe
echo Set GOROOT_BOOTSTRAP to a working Go tree ^>= Go 1.4.
echo Set GOROOT_BOOTSTRAP to a working Go tree ^>= Go 1.17.

:fail
set GOBUILDFAIL=1
Expand Down
6 changes: 3 additions & 3 deletions src/make.rc
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ for(p in $path){
}
if(! test -x $GOROOT_BOOTSTRAP/bin/go){
echo 'ERROR: Cannot find '$GOROOT_BOOTSTRAP'/bin/go.' >[1=2]
echo 'Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.' >[1=2]
echo 'Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.17.' >[1=2]
exit bootstrap
}
if(~ $GOROOT_BOOTSTRAP $GOROOT){
echo 'ERROR: $GOROOT_BOOTSTRAP must not be set to $GOROOT' >[1=2]
echo 'Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.' >[1=2]
echo 'Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.17.' >[1=2]
exit bootstrap
}

Expand Down Expand Up @@ -105,7 +105,7 @@ if(~ $1 --dist-tool){
# Run dist bootstrap to complete make.bash.
# Bootstrap installs a proper cmd/dist, built with the new toolchain.
# Throw ours, built with Go 1.4, away after bootstrap.
# Throw ours, built with Go 1.17, away after bootstrap.
./cmd/dist/dist bootstrap -a $vflag $*
rm -f ./cmd/dist/dist
Expand Down

0 comments on commit cd2bc60

Please sign in to comment.