From 089dcd7b07f047e29d8a2f6e3a68aba00ec78de6 Mon Sep 17 00:00:00 2001 From: David Chase Date: Mon, 21 Nov 2022 16:00:43 -0500 Subject: [PATCH] cmd/dist: add serial/small build option for GOMAXPROCS=1 If GOMAXPROCS=1, force serial execution, which is better for debugging build problems and also minimizes footprint, if that happens to matter. This wasn't good when the bootstrap was 1.4 because there default GOMAXPROCS=1, but that is no longer the bootstrap version. Change-Id: I637e25c8acb4758795fceef63921eda359a7be29 Reviewed-on: https://go-review.googlesource.com/c/go/+/452556 TryBot-Result: Gopher Robot Run-TryBot: David Chase Reviewed-by: Cherry Mui --- src/cmd/dist/main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cmd/dist/main.go b/src/cmd/dist/main.go index 0dc409fc77..6194ea901c 100644 --- a/src/cmd/dist/main.go +++ b/src/cmd/dist/main.go @@ -159,6 +159,12 @@ func main() { if gohostarch == "arm" || gohostarch == "mips64" || gohostarch == "mips64le" { maxbg = min(maxbg, runtime.NumCPU()) } + // For deterministic make.bash debugging and for smallest-possible footprint, + // pay attention to GOMAXPROCS=1. This was a bad idea for 1.4 bootstrap, but + // the bootstrap version is now 1.17+ and thus this is fine. + if runtime.GOMAXPROCS(0) == 1 { + maxbg = 1 + } bginit() if len(os.Args) > 1 && os.Args[1] == "-check-goarm" { -- 2.50.0