]> Cypherpunks repositories - gostls13.git/commit
cmd/go: refactor usage of `modRoots`
authorIan Alexander <jitsu@google.com>
Wed, 20 Aug 2025 23:44:11 +0000 (19:44 -0400)
committerIan Alexander <jitsu@google.com>
Tue, 7 Oct 2025 17:55:25 +0000 (10:55 -0700)
commit6f7926589d03180863aa05cbb55a9d9c63e76b99
treef3b4e741929ab10181519120bf513ec601c20c69
parent11d5484190f80823c9b6312fd40f6491e864111b
cmd/go: refactor usage of `modRoots`

This commit refactors usage of the global variable `modRoots` 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 { modRoots -> LoaderState.modRoots }'
rf 'add State.RootMode \
// These are primarily used to initialize the MainModules, and should\
// be eventually superseded by them but are still used in cases where\
// the module roots are required but MainModules has not been\
// initialized yet. Set to the modRoots of the main modules.\
// modRoots != nil implies len(modRoots) > 0'
rf 'rm modRoots'

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