cmd/go: remove experiment checks for compile -c

There's a comment that we should test that compile -c is compatible with
the fieldtrack and preemptibleloops experiments and then remove the
check disabling -c when those experiments are enabled.

I tested this and the tests pass with fieldtrack (with the exception of one go command test that makes the assumption that fieldtrack is off), and the preemptibleloops experiment is already broken without this experiment.

Also remove the check for the value of the GO19CONCURRENTCOMPILATION
environment variable. The compiler concurrency can be limited by setting
GOMAXPROCS.

Change-Id: I0c02745de463ea572673648061185cd76a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/724680
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
matloob 2025-11-26 10:30:34 -05:00 committed by Gopher Robot
parent 301d9f9b52
commit 3353c100bb
2 changed files with 0 additions and 26 deletions

View file

@ -238,8 +238,6 @@ See also: go install, go get, go clean.
`,
}
const concurrentGCBackendCompilationEnabledByDefault = true
func init() {
// break init cycle
CmdBuild.Run = runBuild

View file

@ -10,7 +10,6 @@ import (
"internal/buildcfg"
"internal/platform"
"io"
"log"
"os"
"path/filepath"
"runtime"
@ -183,29 +182,6 @@ func (gcToolchain) gc(b *Builder, a *Action, archive string, importcfg, embedcfg
// compilerConcurrency returns the compiler concurrency level for a package compilation.
// The returned function must be called after the compile finishes.
func compilerConcurrency() (int, func()) {
// First, check whether we can use -c at all for this compilation.
canDashC := concurrentGCBackendCompilationEnabledByDefault
switch e := os.Getenv("GO19CONCURRENTCOMPILATION"); e {
case "0":
canDashC = false
case "1":
canDashC = true
case "":
// Not set. Use default.
default:
log.Fatalf("GO19CONCURRENTCOMPILATION must be 0, 1, or unset, got %q", e)
}
// TODO: Test and delete these conditions.
if cfg.ExperimentErr != nil || cfg.Experiment.FieldTrack || cfg.Experiment.PreemptibleLoops {
canDashC = false
}
if !canDashC {
return 1, func() {}
}
// Decide how many concurrent backend compilations to allow.
//
// If we allow too many, in theory we might end up with p concurrent processes,