Commit 0ad241dd authored by Russ Cox's avatar Russ Cox

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
parent 1421b4ce
......@@ -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)
}
......
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