]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: fix import directory list for compilation
authorRuss Cox <rsc@golang.org>
Mon, 9 Jan 2012 23:38:07 +0000 (15:38 -0800)
committerRuss Cox <rsc@golang.org>
Mon, 9 Jan 2012 23:38:07 +0000 (15:38 -0800)
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

src/cmd/go/build.go

index e3a96ea421d038f19320e290f0b59a7c351d748b..791ec817de27efeea83229d0b01bdab13bdc789a 100644 (file)
@@ -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)
                }