From: Ian Lance Taylor Date: Tue, 10 Sep 2013 18:27:29 +0000 (-0700) Subject: cmd/go: report real package in errors for go get with wildcard X-Git-Tag: go1.2rc2~280 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a547ad6ac0d7cb83198b1144ae0e87442b746fd9;p=gostls13.git cmd/go: report real package in errors for go get with wildcard Fixes #5054. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/13609043 --- diff --git a/src/cmd/go/get.go b/src/cmd/go/get.go index 83244b2531..b6a3d5ba05 100644 --- a/src/cmd/go/get.go +++ b/src/cmd/go/get.go @@ -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() + } } }