Skip to content

Commit 5210a71

Browse files
author
Bryan C. Mills
committed
run.bat: use cmd/dist instead of 'go install' to rebuild std and cmd
cmd/dist may set and/or unset variables before building, and at any rate it is fragile to run 'go install' before sourcing env.bat. The build-stamp information embedded by the 'go' command is currently sensitive to whether CGO_* variables are implicit or explicit, so running 'go install' before env.bat may cause stamped metadata to become stale. (Explicitly setting to the default arguably ought to produce the same metadata as leaving the variables unset, but that's a separate issue and a bigger cleanup.) Moreover, run.bat is supposed to parallel run.bash, and run.bash already hasn't invoked 'go install' itself since CL 6531! For #52009 Change-Id: Ie35217913f02cc7e0c3f9b12874abd7416473478 Reviewed-on: https://go-review.googlesource.com/c/go/+/398060 Trust: Bryan Mills <[email protected]> Run-TryBot: Bryan Mills <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 592078f commit 5210a71

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/run.bat

+6-12
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,20 @@ set GOBIN=
2424
set GOFLAGS=
2525
set GO111MODULE=
2626

27-
rem TODO avoid rebuild if possible
28-
29-
if x%1==x--no-rebuild goto norebuild
30-
echo ##### Building packages and commands.
31-
..\bin\go install -a -v std cmd
32-
if errorlevel 1 goto fail
33-
echo.
34-
:norebuild
35-
3627
:: get CGO_ENABLED
3728
..\bin\go env > env.bat
3829
if errorlevel 1 goto fail
3930
call env.bat
4031
del env.bat
41-
echo.
4232

43-
..\bin\go tool dist test
33+
if x%1==x--no-rebuild goto norebuild
34+
..\bin\go tool dist test --rebuild
4435
if errorlevel 1 goto fail
45-
echo.
36+
goto end
4637

38+
:norebuild
39+
..\bin\go tool dist test
40+
if errorlevel 1 goto fail
4741
goto end
4842

4943
:fail

0 commit comments

Comments
 (0)