]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go/internal/modget: fix get pkg@none
authorRuss Cox <rsc@golang.org>
Wed, 18 Jul 2018 20:18:29 +0000 (16:18 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 19 Jul 2018 18:15:38 +0000 (18:15 +0000)
Now pkg@none actually removes the pkg instead of dying.

For #26342.

Change-Id: I9df7281ed8fd24480109b36f33a563f92e279244
Reviewed-on: https://go-review.googlesource.com/124796
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/cmd/go/internal/modget/get.go
src/cmd/go/testdata/script/mod_get_downgrade.txt

index 4f97dbb0ceffbe9c0b09ee2ee7afb75695038e68..1fd697048b1d8e08628557dd11923cf8c1540001 100644 (file)
@@ -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),
index e953ac5331452c5b428fd225c75de81dcea7c984..e687403bd97f0370c2edc6e848473a6bb27563fa 100644 (file)
@@ -1,8 +1,15 @@
 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