Commit a547ad6a authored by Ian Lance Taylor's avatar Ian Lance Taylor

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
parent 7f062fa2
...@@ -157,6 +157,7 @@ func download(arg string, stk *importStack, getTestDeps bool) { ...@@ -157,6 +157,7 @@ func download(arg string, stk *importStack, getTestDeps bool) {
pkgs := []*Package{p} pkgs := []*Package{p}
wildcardOkay := len(*stk) == 0 wildcardOkay := len(*stk) == 0
isWildcard := false
// Download if the package is missing, or update if we're using -u. // Download if the package is missing, or update if we're using -u.
if p.Dir == "" || *getU { if p.Dir == "" || *getU {
...@@ -179,6 +180,7 @@ func download(arg string, stk *importStack, getTestDeps bool) { ...@@ -179,6 +180,7 @@ func download(arg string, stk *importStack, getTestDeps bool) {
} else { } else {
args = matchPackages(arg) args = matchPackages(arg)
} }
isWildcard = true
} }
// Clear all relevant package cache entries before // Clear all relevant package cache entries before
...@@ -218,6 +220,12 @@ func download(arg string, stk *importStack, getTestDeps bool) { ...@@ -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. // Process dependencies, now that we know what they are.
for _, dep := range p.deps { for _, dep := range p.deps {
// Don't get test dependencies recursively. // Don't get test dependencies recursively.
...@@ -233,6 +241,10 @@ func download(arg string, stk *importStack, getTestDeps bool) { ...@@ -233,6 +241,10 @@ func download(arg string, stk *importStack, getTestDeps bool) {
download(path, stk, false) download(path, stk, false)
} }
} }
if isWildcard {
stk.pop()
}
} }
} }
......
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