Skip to content

Commit 30f5158

Browse files
committed
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 <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
1 parent b941d2b commit 30f5158

File tree

2 files changed

+9
-20
lines changed

2 files changed

+9
-20
lines changed

src/make.bat

+8-13
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ call .\env.bat
101101
del env.bat
102102
if x%vflag==x-v echo.
103103

104-
if x%1==x-dist-tool goto copydist
105-
if x%2==x-dist-tool goto copydist
106-
if x%3==x-dist-tool goto copydist
107-
if x%4==x-dist-tool goto copydist
108-
if x%1==x--dist-tool goto copydist
109-
if x%2==x--dist-tool goto copydist
110-
if x%3==x--dist-tool goto copydist
111-
if x%4==x--dist-tool goto copydist
104+
if x%1==x--dist-tool (
105+
mkdir "%GOTOOLDIR%" 2>NUL
106+
if not x%2==x (
107+
copy cmd\dist\dist.exe "%2"
108+
)
109+
move cmd\dist\dist.exe "%GOTOOLDIR%\dist.exe"
110+
goto :eof
111+
)
112112

113113
:: Run dist bootstrap to complete make.bash.
114114
:: Bootstrap installs a proper cmd/dist, built with the new toolchain.
@@ -123,11 +123,6 @@ goto :eof
123123
:: to avoid needing three copies in three different shell languages
124124
:: (make.bash, make.bat, make.rc).
125125

126-
:copydist
127-
mkdir "%GOTOOLDIR%" 2>NUL
128-
copy cmd\dist\dist.exe "%GOTOOLDIR%\"
129-
goto :eof
130-
131126
:nogoenv
132127
set GO111MODULE=off
133128
set GOENV=off

src/race.bat

+1-7
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,7 @@ if not exist make.bat (
1414
exit /b 1
1515
)
1616

17-
set GOROOT=%CD%\..
18-
call .\make.bat --dist-tool >NUL || exit /b 1
19-
.\cmd\dist\dist.exe env -w -p >env.bat || exit /b 1
20-
call .\env.bat
21-
del env.bat
22-
23-
if not %GOHOSTARCH% == amd64 (
17+
if not "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
2418
echo Race detector is only supported on windows/amd64.
2519
exit /b 1
2620
)

0 commit comments

Comments
 (0)