[go] cmd/go: refactor usage of `requirements`

1 view
Skip to first unread message

Ian Alexander (Gerrit)

unread,
Oct 7, 2025, 5:08:19 PM (15 hours ago) Oct 7
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Go LUCI, Michael Matloob, Michael Matloob, golang-co...@googlegroups.com

Ian Alexander submitted the change

Unreviewed changes

5 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.

Change information

Commit message:
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-by: Michael Matloob <mat...@golang.org>
Reviewed-by: Michael Matloob <mat...@google.com>
Files:
  • M src/cmd/go/internal/modload/buildlist.go
  • M src/cmd/go/internal/modload/init.go
  • M src/cmd/go/internal/modload/list.go
  • M src/cmd/go/internal/modload/load.go
Change size: M
Delta: 4 files changed, 40 insertions(+), 39 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Michael Matloob, +2 by Michael Matloob
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I9d7d1d301a9e89f9214ce632fa5b656dd2940f39
Gerrit-Change-Number: 698061
Gerrit-PatchSet: 12
Gerrit-Owner: Ian Alexander <ji...@google.com>
Gerrit-Reviewer: Ian Alexander <ji...@google.com>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-Reviewer: Michael Matloob <mat...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages