]> Cypherpunks repositories - gostls13.git/commitdiff
run.bat: use cmd/dist instead of 'go install' to rebuild std and cmd
authorBryan C. Mills <bcmills@google.com>
Fri, 1 Apr 2022 19:36:17 +0000 (15:36 -0400)
committerBryan Mills <bcmills@google.com>
Tue, 5 Apr 2022 14:18:19 +0000 (14:18 +0000)
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 <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
src/run.bat

index edcaf5265931b8218b7e13990df35ba9e63bd8b3..1f16c493bbcb4a47a8566b96a452809641e09f02 100644 (file)
@@ -24,26 +24,20 @@ set GOBIN=
 set GOFLAGS=\r
 set GO111MODULE=\r
 \r
-rem TODO avoid rebuild if possible\r
-\r
-if x%1==x--no-rebuild goto norebuild\r
-echo ##### Building packages and commands.\r
-..\bin\go install -a -v std cmd\r
-if errorlevel 1 goto fail\r
-echo.\r
-:norebuild\r
-\r
 :: get CGO_ENABLED\r
 ..\bin\go env > env.bat\r
 if errorlevel 1 goto fail\r
 call env.bat\r
 del env.bat\r
-echo.\r
 \r
-..\bin\go tool dist test\r
+if x%1==x--no-rebuild goto norebuild\r
+..\bin\go tool dist test --rebuild\r
 if errorlevel 1 goto fail\r
-echo.\r
+goto end\r
 \r
+:norebuild\r
+..\bin\go tool dist test\r
+if errorlevel 1 goto fail\r
 goto end\r
 \r
 :fail\r