1
0
mirror of https://github.com/golang/go synced 2024-11-18 08:14:41 -07:00

cmd/go: fix missing internal import error

Fixes #11331.

Change-Id: I19b8172421044c301bc136fc8f7bfdadbf880e25
Reviewed-on: https://go-review.googlesource.com/12450
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
This commit is contained in:
Russ Cox 2015-07-20 20:05:37 -04:00
parent 3cf15b57f7
commit d709434313
5 changed files with 25 additions and 1 deletions

View File

@ -967,6 +967,14 @@ func TestInternalPackageErrorsAreHandled(t *testing.T) {
tg.run("list", "./testdata/testinternal3")
}
func TestInternalCache(t *testing.T) {
tg := testgo(t)
defer tg.cleanup()
tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata/testinternal4"))
tg.runFail("build", "p")
tg.grepStderr("internal", "did not fail to build p")
}
func TestMoveGit(t *testing.T) {
testMove(t, "git", "rsc.io/pdf", "pdf", "rsc.io/pdf/.git/config")
}

View File

@ -882,7 +882,13 @@ func (p *Package) load(stk *importStack, bp *build.Package, err error) *Package
deps[path] = p1
imports = append(imports, p1)
for _, dep := range p1.deps {
deps[dep.ImportPath] = dep
// Do not overwrite entries installed by direct import
// just above this loop. Those have stricter constraints
// about internal and vendor visibility and may contain
// errors that we need to preserve.
if deps[dep.ImportPath] == nil {
deps[dep.ImportPath] = dep
}
}
if p1.Incomplete {
p.Incomplete = true

View File

@ -0,0 +1,6 @@
package p
import (
_ "q/internal/x"
_ "q/j"
)

View File

@ -0,0 +1 @@
package x

View File

@ -0,0 +1,3 @@
package j
import _ "q/internal/x"