]> Cypherpunks repositories - gostls13.git/commit
cmd/go: use local state object in `modget.runGet`
authorIan Alexander <jitsu@google.com>
Thu, 9 Oct 2025 00:20:22 +0000 (20:20 -0400)
committerIan Alexander <jitsu@google.com>
Sat, 25 Oct 2025 01:09:07 +0000 (18:09 -0700)
commitfe345ff2ae7449ca41a0d0ab7fca9168d29ffd46
treeb8e4ae3e3e580ee689fffbd93014e25a60d8702e
parentd312e27e8b63371eece000cfc145f32432aff619
cmd/go: use local state object in `modget.runGet`

This commit modifies `modget.runGet` to construct a new modload.State
object using the new constructor instead of the current global
`modload.LoaderState` variable.

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

[git-generate]
cd src/cmd/go/internal/modget
rf '
  add get.go:/func runGet\(/-0 var moduleLoaderState *modload.State
  ex {
    import "cmd/go/internal/modload";
    modload.LoaderState -> moduleLoaderState
  }
  add runGet://+0 moduleLoaderState := modload.NewState()
  rm get.go:/var moduleLoaderState \*modload.State/
'

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