cmd/go/internal/mvs: omit modules at version "none" in BuildList and Req

For #37438

Change-Id: Icb28035ae4027aa09d8959d4ac2f4b94a6c843a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/266339
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
Bryan C. Mills 2020-10-28 21:29:19 -04:00
parent fb184a383e
commit 34665c63ff
2 changed files with 13 additions and 1 deletions

View File

@ -120,7 +120,9 @@ func buildList(target module.Version, reqs Reqs, upgrade func(module.Version) (m
}
node.required = required
for _, r := range node.required {
work.Add(r)
if r.Version != "none" {
work.Add(r)
}
}
if upgrade != nil {
@ -208,6 +210,9 @@ func buildList(target module.Version, reqs Reqs, upgrade func(module.Version) (m
n := modGraph[module.Version{Path: path, Version: vers}]
required := n.required
for _, r := range required {
if r.Version == "none" {
continue
}
v := min[r.Path]
if r.Path != target.Path && reqs.Max(v, r.Version) != v {
panic(fmt.Sprintf("mistake: version %q does not satisfy requirement %+v", v, r)) // TODO: Don't panic.

View File

@ -317,6 +317,13 @@ B1: X2
X1: I1
X2:
req M: A1 B1
name: reqnone
M: Anone B1 D1 E1
B1: Cnone D1
E1: Fnone
build M: M B1 D1 E1
req M: B1 E1
`
func Test(t *testing.T) {