]> Cypherpunks repositories - gostls13.git/commit
cmd/go: use local state object in `run.runRun`
authorIan Alexander <jitsu@google.com>
Thu, 2 Oct 2025 16:52:26 +0000 (12:52 -0400)
committerIan Alexander <jitsu@google.com>
Sat, 25 Oct 2025 01:08:10 +0000 (18:08 -0700)
commit2c4fd7b2cd08234fe13c0e9de8d42dba33086a81
tree3fa65a12242e66acafb4412577a754bc220baa9f
parentade9f33e1f65cb51cbf15289edef4b60f201a01e
cmd/go: use local state object in `run.runRun`

This commit modifies `run.runRun` 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/run
rf '
  add run.go:/func runRun\(/-0 var moduleLoaderState *modload.State
  ex {
    import "cmd/go/internal/modload";
    modload.LoaderState -> moduleLoaderState
  }
  add runRun://+0 moduleLoaderState := modload.NewState()
  rm run.go:/var moduleLoaderState \*modload.State/
'

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