diff options
author | Bryan C. Mills <bcmills@google.com> | 2020-11-20 17:03:42 -0500 |
---|---|---|
committer | Bryan C. Mills <bcmills@google.com> | 2020-11-21 03:29:37 +0000 |
commit | f93ef07b1143abf3003555c4afcadc0e9842cbf8 (patch) | |
tree | aad0ee4f51ff9da490d504d6fc2f43ae582d72a7 /src/cmd/go/internal/modload/init.go | |
parent | 3f5a97514b16c432d9699a0f1a913fabd3c0cb86 (diff) | |
download | go-f93ef07b1143abf3003555c4afcadc0e9842cbf8.tar.gz go-f93ef07b1143abf3003555c4afcadc0e9842cbf8.zip |
cmd/go/internal/modload: remove the Reqs function
The Reqs function returns an mvs.Reqs implemention for the global
build list. The API that it presents assumes that the build list is
globally consistent (problematic for #40775) and readily available
(problematic for #36460).
Fortunately, it is no longer used outside of the modload package.
We can instead use individual instances of the unexported mvsReqs
struct, making the dependency on the global build list more explicit.
For #36460
For #40775
Change-Id: I8674442f2a86416b0bf9c3395cb591c1e724c9d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/272129
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/cmd/go/internal/modload/init.go')
-rw-r--r-- | src/cmd/go/internal/modload/init.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/go/internal/modload/init.go b/src/cmd/go/internal/modload/init.go index b9345acbce..a9b77c82b3 100644 --- a/src/cmd/go/internal/modload/init.go +++ b/src/cmd/go/internal/modload/init.go @@ -853,7 +853,7 @@ func MinReqs() mvs.Reqs { retain = append(retain, m.Path) } } - min, err := mvs.Req(Target, retain, Reqs()) + min, err := mvs.Req(Target, retain, &mvsReqs{buildList: buildList}) if err != nil { base.Fatalf("go: %v", err) } @@ -985,7 +985,7 @@ func keepSums(addDirect bool) map[module.Version]bool { keep := make(map[module.Version]bool) var mu sync.Mutex reqs := &keepSumReqs{ - Reqs: Reqs(), + Reqs: &mvsReqs{buildList: buildList}, visit: func(m module.Version) { // If we build using a replacement module, keep the sum for the replacement, // since that's the code we'll actually use during a build. |