Commit 9039c2c0 authored by Russ Cox's avatar Russ Cox

cmd/go/internal/modget: fix get pkg@none

Now pkg@none actually removes the pkg instead of dying.

For #26342.

Change-Id: I9df7281ed8fd24480109b36f33a563f92e279244
Reviewed-on: https://go-review.googlesource.com/124796Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
parent 269a9382
......@@ -356,16 +356,17 @@ func runGet(cmd *base.Command, args []string) {
}
lookup.Do(10, func(item interface{}) {
t := item.(*task)
if t.vers == "none" {
// Wait for downgrade step.
t.m = module.Version{Path: t.path, Version: "none"}
return
}
m, err := getQuery(t.path, t.vers, t.forceModulePath)
if err != nil {
base.Errorf("go get %v: %v", t.arg, err)
return
}
t.m = m
if t.vers == "none" {
// Wait for downgrade step.
return
}
// If there is no -u, then we don't need to upgrade the
// collected requirements separately from the overall
// recalculation of the build list (modload.ReloadBuildList below),
......
env GO111MODULE=on
go get rsc.io/quote@v2.0.0
# downgrade sampler should downgrade quote
go get rsc.io/sampler@v1.0.0
go list -m all
stdout 'rsc.io/quote v0.0.0-'
stdout 'rsc.io/quote v1.4.0'
stdout 'rsc.io/sampler v1.0.0'
# downgrade sampler away should downgrade quote further
go get rsc.io/sampler@none
go list -m all
stdout 'rsc.io/quote v1.3.0'
-- go.mod --
module x
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment