]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: removed unused code in toolchain.Exec
authorIan Alexander <jitsu@google.com>
Wed, 1 Oct 2025 21:42:38 +0000 (17:42 -0400)
committerIan Alexander <jitsu@google.com>
Mon, 27 Oct 2025 20:28:15 +0000 (13:28 -0700)
This change removes the unused module loader state in the function
`toolchain.Exec`.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: I8935f14447db4669457becc5a96db7f45132772f
Reviewed-on: https://go-review.googlesource.com/c/go/+/709980
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
src/cmd/go/internal/toolchain/select.go

index 86aa89dd7d4a1d3613513e65887cd0b92b3cab97..e7201e2f5fbb279a487e4e4e5c16933461c78a40 100644 (file)
@@ -285,6 +285,7 @@ func Select() {
 
        counterSelectExec.Inc()
        Exec(moduleLoaderState, gotoolchain)
+       panic("unreachable")
 }
 
 var counterSelectExec = counter.New("go/toolchain/select-exec")
@@ -352,12 +353,6 @@ func Exec(s *modload.State, gotoolchain string) {
                base.Fatalf("cannot find %q in PATH", gotoolchain)
        }
 
-       // Set up modules without an explicit go.mod, to download distribution.
-       s.Reset()
-       s.ForceUseModules = true
-       s.RootMode = modload.NoRoot
-       modload.Init(s)
-
        // Download and unpack toolchain module into module cache.
        // Note that multiple go commands might be doing this at the same time,
        // and that's OK: the module cache handles that case correctly.