Commit d7094343 authored by Russ Cox's avatar Russ Cox

cmd/go: fix missing internal import error

Fixes #11331.

Change-Id: I19b8172421044c301bc136fc8f7bfdadbf880e25
Reviewed-on: https://go-review.googlesource.com/12450Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
parent 3cf15b57
......@@ -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")
}
......
......@@ -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
......
package p
import (
_ "q/internal/x"
_ "q/j"
)
package j
import _ "q/internal/x"
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