]> Cypherpunks repositories - gostls13.git/commit
cmd/go: refactor injection of modload.LoaderState
authorIan Alexander <jitsu@google.com>
Tue, 7 Oct 2025 16:57:12 +0000 (12:57 -0400)
committerIan Alexander <jitsu@google.com>
Fri, 24 Oct 2025 14:27:27 +0000 (07:27 -0700)
commit29046398bb9081ea8f8ff3befa770e86d60b1e05
treeba1900c4c09cdd1c64d642992f42a8420f6ee12c
parentc18fa69e528f1679cd9b4c1c04a95f048c68000e
cmd/go: refactor injection of modload.LoaderState

This change refactors the injection of the global
`modload.LoaderState` variable such that the injection can occur later
in the chain of function calls.  This allows us to keep the behavior
of the global PerPackageFlags (e.g. BuildGcFlags, etc) consistent and
avoid introducing a dependency on the module loader state there.

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

Change-Id: I1a0cc07173a1804426392581ba8de4ae1e30cdef
Reviewed-on: https://go-review.googlesource.com/c/go/+/711115
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/load/flag.go
src/cmd/go/internal/load/flag_test.go
src/cmd/go/internal/load/pkg.go
src/cmd/go/internal/load/search.go
src/cmd/go/internal/load/test.go
src/cmd/go/internal/test/test.go
src/cmd/go/internal/work/action.go