]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: report real package in errors for go get with wildcard
authorIan Lance Taylor <iant@golang.org>
Tue, 10 Sep 2013 18:27:29 +0000 (11:27 -0700)
committerIan Lance Taylor <iant@golang.org>
Tue, 10 Sep 2013 18:27:29 +0000 (11:27 -0700)
Fixes #5054.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/13609043

src/cmd/go/get.go

index 83244b2531d1f177587311f28d84ba29a9031511..b6a3d5ba05e535c1c766557c7dc9ee6f2be80e76 100644 (file)
@@ -157,6 +157,7 @@ func download(arg string, stk *importStack, getTestDeps bool) {
 
        pkgs := []*Package{p}
        wildcardOkay := len(*stk) == 0
+       isWildcard := false
 
        // Download if the package is missing, or update if we're using -u.
        if p.Dir == "" || *getU {
@@ -179,6 +180,7 @@ func download(arg string, stk *importStack, getTestDeps bool) {
                        } else {
                                args = matchPackages(arg)
                        }
+                       isWildcard = true
                }
 
                // Clear all relevant package cache entries before
@@ -218,6 +220,12 @@ func download(arg string, stk *importStack, getTestDeps bool) {
                        }
                }
 
+               if isWildcard {
+                       // Report both the real package and the
+                       // wildcard in any error message.
+                       stk.push(p.ImportPath)
+               }
+
                // Process dependencies, now that we know what they are.
                for _, dep := range p.deps {
                        // Don't get test dependencies recursively.
@@ -233,6 +241,10 @@ func download(arg string, stk *importStack, getTestDeps bool) {
                                download(path, stk, false)
                        }
                }
+
+               if isWildcard {
+                       stk.pop()
+               }
        }
 }