]> Cypherpunks repositories - gostls13.git/commit
cmd/go: use local state object in `test.runTest`
authorIan Alexander <jitsu@google.com>
Thu, 9 Oct 2025 00:21:59 +0000 (20:21 -0400)
committerIan Alexander <jitsu@google.com>
Sat, 25 Oct 2025 01:09:25 +0000 (18:09 -0700)
commit2e12c5db11febd8a975d297255c939da30d62de1
tree8f8a16162e64fbd5f39f68a6afe66b582534f099
parentfe345ff2ae7449ca41a0d0ab7fca9168d29ffd46
cmd/go: use local state object in `test.runTest`

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

Change-Id: Ia387160f30818714ab578c5b78713e532cd394df
Reviewed-on: https://go-review.googlesource.com/c/go/+/711127
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/test/test.go