]> Cypherpunks repositories - gostls13.git/commit
cmd/go: add modload.State parameter to AllowedFunc
authorIan Alexander <jitsu@google.com>
Fri, 3 Oct 2025 02:52:08 +0000 (22:52 -0400)
committerIan Alexander <jitsu@google.com>
Fri, 24 Oct 2025 14:24:18 +0000 (07:24 -0700)
commit296ecc918d6688b5eeb9abe32d919b0aaa76d798
tree8beb68b35817ad2e5544c7bdd3d318c36a713d26
parentc445a61e5256914510f201d5bda5e526249217d6
cmd/go: add modload.State parameter to AllowedFunc

This change makes the following functions methods on the State:
  * CheckAllowed
  * CheckExclusions
  * CheckRetractions

Doing so allows us to reduce the use of the global state variable in
downstream function calls.

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

Change-Id: I97147311d9de16ecac8c122c2b6bdde94bad9d8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/711119
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/load/pkg.go
src/cmd/go/internal/modget/get.go
src/cmd/go/internal/modload/build.go
src/cmd/go/internal/modload/import.go
src/cmd/go/internal/modload/list.go
src/cmd/go/internal/modload/modfile.go
src/cmd/go/internal/modload/mvs.go
src/cmd/go/internal/modload/query_test.go
src/cmd/go/internal/toolchain/select.go