]> Cypherpunks repositories - gostls13.git/commit
cmd/go: refactor usage of `requirements`
authorIan Alexander <jitsu@google.com>
Thu, 21 Aug 2025 00:14:59 +0000 (20:14 -0400)
committerIan Alexander <jitsu@google.com>
Tue, 7 Oct 2025 21:08:14 +0000 (14:08 -0700)
commit162392773085d4cc12072200853a0424117983c0
tree58ce48feb897eb9956885521446fd44bbf0d7cc6
parenta1661e776f57602b4d4470389a0246f9784fd722
cmd/go: refactor usage of `requirements`

This commit refactors usage of the global variable `requirements` to
the global LoaderState field of the same name.

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

[git-generate]
cd src/cmd/go/internal/modload
rf 'ex { requirements -> LoaderState.requirements }'
rf 'add State.MainModules \
// requirements is the requirement graph for the main module.\
//\
// It is always non-nil if the main module'\\\''s go.mod file has been\
// loaded.\
//\
// This variable should only be read from the loadModFile\
// function, and should only be written in the loadModFile and\
// commitRequirements functions.  All other functions that need or\
// produce a *Requirements should accept and/or return an explicit\
// parameter.'
rf 'rm requirements'

Change-Id: I9d7d1d301a9e89f9214ce632fa5b656dd2940f39
Reviewed-on: https://go-review.googlesource.com/c/go/+/698061
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
src/cmd/go/internal/modload/buildlist.go
src/cmd/go/internal/modload/init.go
src/cmd/go/internal/modload/list.go
src/cmd/go/internal/modload/load.go