make.bat,race.bat: simplify --dist-tool handling

make.bat accepts the --dist-tool flag on multiple flag positions
and also allows omitting the trailing dash. Doing so adds complexity
and is not aligned with the make.bash and make.rc behavior. Remove that
flexibility to simplify the code and make it more consistent. This also
fixes a bug where dist.exe wouldn't be removed from cmd\dist when
running make.bat --dist-tool.

Also, there is no need for race.bat to invoke make.bat with --dist-tool.
It uses it to get the GOHOSTARCH env value, but we can already get
that from the built-in PROCESSOR_ARCHITECTURE env variable.

Change-Id: Ia673562c1ae6aff9bd3ec7aa8cdd25ff187eeb79
Reviewed-on: https://go-review.googlesource.com/c/go/+/648615
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
qmuntal 2025-02-11 18:23:11 +00:00 committed by Quim Muntal
parent b941d2b6d8
commit 30f515898c
2 changed files with 9 additions and 20 deletions

View file

@ -101,14 +101,14 @@ call .\env.bat
del env.bat
if x%vflag==x-v echo.
if x%1==x-dist-tool goto copydist
if x%2==x-dist-tool goto copydist
if x%3==x-dist-tool goto copydist
if x%4==x-dist-tool goto copydist
if x%1==x--dist-tool goto copydist
if x%2==x--dist-tool goto copydist
if x%3==x--dist-tool goto copydist
if x%4==x--dist-tool goto copydist
if x%1==x--dist-tool (
mkdir "%GOTOOLDIR%" 2>NUL
if not x%2==x (
copy cmd\dist\dist.exe "%2"
)
move cmd\dist\dist.exe "%GOTOOLDIR%\dist.exe"
goto :eof
)
:: Run dist bootstrap to complete make.bash.
:: Bootstrap installs a proper cmd/dist, built with the new toolchain.
@ -123,11 +123,6 @@ goto :eof
:: to avoid needing three copies in three different shell languages
:: (make.bash, make.bat, make.rc).
:copydist
mkdir "%GOTOOLDIR%" 2>NUL
copy cmd\dist\dist.exe "%GOTOOLDIR%\"
goto :eof
:nogoenv
set GO111MODULE=off
set GOENV=off

View file

@ -14,13 +14,7 @@ if not exist make.bat (
exit /b 1
)
set GOROOT=%CD%\..
call .\make.bat --dist-tool >NUL || exit /b 1
.\cmd\dist\dist.exe env -w -p >env.bat || exit /b 1
call .\env.bat
del env.bat
if not %GOHOSTARCH% == amd64 (
if not "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
echo Race detector is only supported on windows/amd64.
exit /b 1
)