]> Cypherpunks repositories - gostls13.git/commit
cmd/go: use local state object in `vet.runVet`
authorIan Alexander <jitsu@google.com>
Fri, 10 Oct 2025 00:22:22 +0000 (20:22 -0400)
committerIan Alexander <jitsu@google.com>
Sat, 25 Oct 2025 01:10:11 +0000 (18:10 -0700)
commitf2dd3d7e316ab022e87bf56a8a2d77fd8f20c390
tree9bb5a996bba5e748f00ac206a0576eeda0c28236
parent784700439ab9b0792bdc19fe72672d4d7171eef6
cmd/go: use local state object in `vet.runVet`

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

Change-Id: I31c7f3ea8d301b9210f5afeb632afb5b53e93e46
Reviewed-on: https://go-review.googlesource.com/c/go/+/711130
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/vet/vet.go