From 498d8d537153a210e45d356d779aee74de5acda1 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Wed, 18 Nov 2020 13:44:39 -0500 Subject: [PATCH] cmd/go/internal/work: avoid modload.Selected in 'go install pkg@version' At this point in installOutsideModule the build list is empty, so Selected trivially returns "none" for all modules. (This change could have been made in CL 266657, but it was a bit simpler to update the QueryPattern call sites mechanically to ensure that there would be no unintentional semantic drift.) For #36460 Change-Id: I44fb73794985bfeebb1dde0c092313f319c2945a Reviewed-on: https://go-review.googlesource.com/c/go/+/271419 Trust: Bryan C. Mills Run-TryBot: Bryan C. Mills TryBot-Result: Go Bot Reviewed-by: Jay Conrod --- src/cmd/go/internal/work/build.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go index 0f91a86311..e0aa691659 100644 --- a/src/cmd/go/internal/work/build.go +++ b/src/cmd/go/internal/work/build.go @@ -765,7 +765,8 @@ func installOutsideModule(ctx context.Context, args []string) { // Don't check for retractions if a specific revision is requested. allowed = nil } - qrs, err := modload.QueryPackages(ctx, patterns[0], version, modload.Selected, allowed) + noneSelected := func(path string) (version string) { return "none" } + qrs, err := modload.QueryPackages(ctx, patterns[0], version, noneSelected, allowed) if err != nil { base.Fatalf("go install %s: %v", args[0], err) } -- 2.50.0