mirror of
https://github.com/golang/go
synced 2024-11-25 01:47:56 -07:00
cmd/go: fix import directory list for compilation
This fixes the most annoying bug in the go command, that 'go build' sometimes ignored packages it had just rebuilt in favor of stale installed ones. This part of the code needs more thought, but this small change is an important improvement. R=golang-dev, adg CC=golang-dev https://golang.org/cl/5531053
This commit is contained in:
parent
1421b4ceff
commit
0ad241dd55
@ -509,9 +509,9 @@ func (b *builder) build(a *action) error {
|
||||
incMap[build.Path[0].PkgDir()] = true // goroot
|
||||
incMap[""] = true // ignore empty strings
|
||||
|
||||
// build package directories of dependencies
|
||||
// temporary build package directories of dependencies.
|
||||
for _, a1 := range a.deps {
|
||||
if pkgdir := a1.pkgdir; !incMap[pkgdir] {
|
||||
if pkgdir := a1.pkgdir; pkgdir != a1.p.t.PkgDir() && !incMap[pkgdir] {
|
||||
incMap[pkgdir] = true
|
||||
inc = append(inc, "-I", pkgdir)
|
||||
}
|
||||
@ -522,7 +522,7 @@ func (b *builder) build(a *action) error {
|
||||
|
||||
// then installed package directories of dependencies
|
||||
for _, a1 := range a.deps {
|
||||
if pkgdir := a1.p.t.PkgDir(); !incMap[pkgdir] {
|
||||
if pkgdir := a1.p.t.PkgDir(); pkgdir == a1.pkgdir && !incMap[pkgdir] {
|
||||
incMap[pkgdir] = true
|
||||
inc = append(inc, "-I", pkgdir)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user