mirror of
https://github.com/golang/go
synced 2024-11-27 04:11:22 -07:00
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
This commit is contained in:
parent
7f062fa2de
commit
a547ad6ac0
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user