diff options
| author | qmuntal <quimmuntal@gmail.com> | 2025-02-06 10:55:59 +0100 |
|---|---|---|
| committer | Quim Muntal <quimmuntal@gmail.com> | 2025-02-07 09:13:54 -0800 |
| commit | 580a383103f2bc67955a146a2d45b7c0c98dae8a (patch) | |
| tree | c891f80c6511f092d561150602c460ccdaac9e94 /src/make.bat | |
| parent | 302bf3631493417b365d693788357973a379a03d (diff) | |
| download | go-580a383103f2bc67955a146a2d45b7c0c98dae8a.tar.xz | |
{all,clean,make,race,run}.bat: use || instead of "if errorlevel 1"
"if errorlevel 1" is and old construct that returns true if the
errorlevel is greater than or equal to 1. There are better alternatives
since Windows NT. For example, the || operator runs the RHS operand if
the preceding command failed, determined by checking that the errorlevel
is different from 0. This approach is more robust -it also works with
negative errorlevels- and is less verbose.
Change-Id: I2070d654d8f9dd41a6cd586ba5ad5f4fea0638ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/647136
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Diffstat (limited to 'src/make.bat')
| -rw-r--r-- | src/make.bat | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/make.bat b/src/make.bat index 3a72a59470..57e4e5f80c 100644 --- a/src/make.bat +++ b/src/make.bat @@ -101,11 +101,9 @@ echo Building Go cmd/dist using %GOROOT_BOOTSTRAP%. (%GOROOT_BOOTSTRAP_VERSION%) if x%vflag==x-v echo cmd/dist
set GOROOT=%GOROOT_BOOTSTRAP%
set GOBIN=
-"%GOROOT_BOOTSTRAP%\bin\go.exe" build -o cmd\dist\dist.exe .\cmd\dist
+"%GOROOT_BOOTSTRAP%\bin\go.exe" build -o cmd\dist\dist.exe .\cmd\dist || goto fail
endlocal
-if errorlevel 1 goto fail
-.\cmd\dist\dist.exe env -w -p >env.bat
-if errorlevel 1 goto fail
+.\cmd\dist\dist.exe env -w -p >env.bat || goto fail
call .\env.bat
del env.bat
if x%vflag==x-v echo.
@@ -148,8 +146,7 @@ if x%4==x--distpack set bootstrapflags=%bootstrapflags% -distpack :: Run dist bootstrap to complete make.bash.
:: Bootstrap installs a proper cmd/dist, built with the new toolchain.
:: Throw ours, built with the bootstrap toolchain, away after bootstrap.
-.\cmd\dist\dist.exe bootstrap -a %vflag% %bootstrapflags%
-if errorlevel 1 goto fail
+.\cmd\dist\dist.exe bootstrap -a %vflag% %bootstrapflags% || goto fail
del .\cmd\dist\dist.exe
goto :eof
|
