From: Ian Alexander Date: Wed, 1 Oct 2025 21:42:38 +0000 (-0400) Subject: cmd/go: removed unused code in toolchain.Exec X-Git-Tag: go1.26rc1~466 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a6929cf4a7;p=gostls13.git cmd/go: removed unused code in toolchain.Exec 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 LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Matloob --- diff --git a/src/cmd/go/internal/toolchain/select.go b/src/cmd/go/internal/toolchain/select.go index 86aa89dd7d..e7201e2f5f 100644 --- a/src/cmd/go/internal/toolchain/select.go +++ b/src/cmd/go/internal/toolchain/select.go @@ -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.