From 34665c63ff39b83dcc5d3ca6400c19ee737ac988 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Wed, 28 Oct 2020 21:29:19 -0400 Subject: [PATCH] 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 Reviewed-by: Jay Conrod Reviewed-by: Michael Matloob TryBot-Result: Go Bot Trust: Bryan C. Mills --- src/cmd/go/internal/mvs/mvs.go | 7 ++++++- src/cmd/go/internal/mvs/mvs_test.go | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/cmd/go/internal/mvs/mvs.go b/src/cmd/go/internal/mvs/mvs.go index ea23a9f45e..3524a7a90e 100644 --- a/src/cmd/go/internal/mvs/mvs.go +++ b/src/cmd/go/internal/mvs/mvs.go @@ -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. diff --git a/src/cmd/go/internal/mvs/mvs_test.go b/src/cmd/go/internal/mvs/mvs_test.go index 9a30a8c3ac..f6f07b200e 100644 --- a/src/cmd/go/internal/mvs/mvs_test.go +++ b/src/cmd/go/internal/mvs/mvs_test.go @@ -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) { -- 2.48.1