\r
:: Keep environment variables within this script\r
:: unless invoked with --no-local.\r
+if x%1==x-no-local goto nolocal\r
+if x%2==x-no-local goto nolocal\r
+if x%3==x-no-local goto nolocal\r
+if x%4==x-no-local goto nolocal\r
if x%1==x--no-local goto nolocal\r
if x%2==x--no-local goto nolocal\r
if x%3==x--no-local goto nolocal\r
if not "x%GOROOT_BOOTSTRAP%"=="x" goto bootstrapset\r
for /f "tokens=*" %%g in ('where go 2^>nul') do (\r
if "x%GOROOT_BOOTSTRAP%"=="x" (\r
- for /f "tokens=*" %%i in ('%%g env GOROOT 2^>nul') do (\r
+ setlocal\r
+ call :nogoenv\r
+ for /f "tokens=*" %%i in ('"%%g" env GOROOT 2^>nul') do (\r
+ endlocal\r
if /I not "%%i"=="%GOROOT_TEMP%" (\r
set GOROOT_BOOTSTRAP=%%i\r
)\r
)\r
)\r
)\r
-if "x%GOROOT_BOOTSTRAP%"=="x" if exist "%HOMEDRIVE%%HOMEPATH%\go1.17" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\go1.17\r
-if "x%GOROOT_BOOTSTRAP%"=="x" if exist "%HOMEDRIVE%%HOMEPATH%\sdk\go1.17" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\sdk\go1.17\r
+\r
+set bootgo=1.20.6\r
+if "x%GOROOT_BOOTSTRAP%"=="x" if exist "%HOMEDRIVE%%HOMEPATH%\go%bootgo%" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\go%bootgo%\r
+if "x%GOROOT_BOOTSTRAP%"=="x" if exist "%HOMEDRIVE%%HOMEPATH%\sdk\go%bootgo%" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\sdk\go%bootgo%\r
if "x%GOROOT_BOOTSTRAP%"=="x" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\Go1.4\r
\r
:bootstrapset\r
set GOROOT_TEMP=\r
\r
setlocal\r
-set GOOS=\r
-set GOARCH=\r
-set GOEXPERIMENT=\r
+call :nogoenv\r
for /f "tokens=*" %%g IN ('"%GOROOT_BOOTSTRAP%\bin\go" version') do (set GOROOT_BOOTSTRAP_VERSION=%%g)\r
set GOROOT_BOOTSTRAP_VERSION=%GOROOT_BOOTSTRAP_VERSION:go version =%\r
echo Building Go cmd/dist using %GOROOT_BOOTSTRAP%. (%GOROOT_BOOTSTRAP_VERSION%)\r
if x%vflag==x-v echo cmd/dist\r
set GOROOT=%GOROOT_BOOTSTRAP%\r
set GOBIN=\r
-set GO111MODULE=off\r
-set GOENV=off\r
-set GOFLAGS=\r
"%GOROOT_BOOTSTRAP%\bin\go.exe" build -o cmd\dist\dist.exe .\cmd\dist\r
endlocal\r
if errorlevel 1 goto fail\r
del env.bat\r
if x%vflag==x-v echo.\r
\r
+if x%1==x-dist-tool goto copydist\r
+if x%2==x-dist-tool goto copydist\r
+if x%3==x-dist-tool goto copydist\r
+if x%4==x-dist-tool goto copydist\r
if x%1==x--dist-tool goto copydist\r
if x%2==x--dist-tool goto copydist\r
if x%3==x--dist-tool goto copydist\r
if x%4==x--dist-tool goto copydist\r
\r
set bootstrapflags=\r
-if x%1==x--no-clean set bootstrapflags=--no-clean\r
-if x%2==x--no-clean set bootstrapflags=--no-clean\r
-if x%3==x--no-clean set bootstrapflags=--no-clean\r
-if x%4==x--no-clean set bootstrapflags=--no-clean\r
-if x%1==x--no-banner set bootstrapflags=%bootstrapflags% --no-banner\r
-if x%2==x--no-banner set bootstrapflags=%bootstrapflags% --no-banner\r
-if x%3==x--no-banner set bootstrapflags=%bootstrapflags% --no-banner\r
-if x%4==x--no-banner set bootstrapflags=%bootstrapflags% --no-banner\r
+if x%1==x-no-clean set bootstrapflags=-no-clean\r
+if x%2==x-no-clean set bootstrapflags=-no-clean\r
+if x%3==x-no-clean set bootstrapflags=-no-clean\r
+if x%4==x-no-clean set bootstrapflags=-no-clean\r
+if x%1==x--no-clean set bootstrapflags=-no-clean\r
+if x%2==x--no-clean set bootstrapflags=-no-clean\r
+if x%3==x--no-clean set bootstrapflags=-no-clean\r
+if x%4==x--no-clean set bootstrapflags=-no-clean\r
+if x%1==x-no-banner set bootstrapflags=%bootstrapflags% -no-banner\r
+if x%2==x-no-banner set bootstrapflags=%bootstrapflags% -no-banner\r
+if x%3==x-no-banner set bootstrapflags=%bootstrapflags% -no-banner\r
+if x%4==x-no-banner set bootstrapflags=%bootstrapflags% -no-banner\r
+if x%1==x--no-banner set bootstrapflags=%bootstrapflags% -no-banner\r
+if x%2==x--no-banner set bootstrapflags=%bootstrapflags% -no-banner\r
+if x%3==x--no-banner set bootstrapflags=%bootstrapflags% -no-banner\r
+if x%4==x--no-banner set bootstrapflags=%bootstrapflags% -no-banner\r
+if x%1==x-distpack set bootstrapflags=%bootstrapflags% -distpack\r
+if x%2==x-distpack set bootstrapflags=%bootstrapflags% -distpack\r
+if x%3==x-distpack set bootstrapflags=%bootstrapflags% -distpack\r
+if x%4==x-distpack set bootstrapflags=%bootstrapflags% -distpack\r
+if x%1==x--distpack set bootstrapflags=%bootstrapflags% -distpack\r
+if x%2==x--distpack set bootstrapflags=%bootstrapflags% -distpack\r
+if x%3==x--distpack set bootstrapflags=%bootstrapflags% -distpack\r
+if x%4==x--distpack set bootstrapflags=%bootstrapflags% -distpack\r
\r
:: Run dist bootstrap to complete make.bash.\r
:: Bootstrap installs a proper cmd/dist, built with the new toolchain.\r
.\cmd\dist\dist.exe bootstrap -a %vflag% %bootstrapflags%\r
if errorlevel 1 goto fail\r
del .\cmd\dist\dist.exe\r
-goto end\r
+goto :eof\r
\r
:: DO NOT ADD ANY NEW CODE HERE.\r
:: The bootstrap+del above are the final step of make.bat.\r
:copydist\r
mkdir "%GOTOOLDIR%" 2>NUL\r
copy cmd\dist\dist.exe "%GOTOOLDIR%\"\r
-goto end\r
+goto :eof\r
+\r
+:nogoenv\r
+set GO111MODULE=off\r
+set GOENV=off\r
+set GOOS=\r
+set GOARCH=\r
+set GOEXPERIMENT=\r
+set GOFLAGS=\r
+goto :eof\r
\r
:bootstrapfail\r
echo ERROR: Cannot find %GOROOT_BOOTSTRAP%\bin\go.exe\r
-echo Set GOROOT_BOOTSTRAP to a working Go tree ^>= Go 1.17.\r
+echo Set GOROOT_BOOTSTRAP to a working Go tree ^>= Go %bootgo%.\r
\r
:fail\r
set GOBUILDFAIL=1\r
if x%GOBUILDEXIT%==x1 exit %GOBUILDFAIL%\r
-\r
-:end\r