mirror of
https://github.com/golang/go
synced 2024-11-18 09:04:49 -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:
parent
3cf15b57f7
commit
d709434313
@ -967,6 +967,14 @@ func TestInternalPackageErrorsAreHandled(t *testing.T) {
|
|||||||
tg.run("list", "./testdata/testinternal3")
|
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) {
|
func TestMoveGit(t *testing.T) {
|
||||||
testMove(t, "git", "rsc.io/pdf", "pdf", "rsc.io/pdf/.git/config")
|
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
|
deps[path] = p1
|
||||||
imports = append(imports, p1)
|
imports = append(imports, p1)
|
||||||
for _, dep := range p1.deps {
|
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 {
|
if p1.Incomplete {
|
||||||
p.Incomplete = true
|
p.Incomplete = true
|
||||||
|
6
src/cmd/go/testdata/testinternal4/src/p/p.go
vendored
Normal file
6
src/cmd/go/testdata/testinternal4/src/p/p.go
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package p
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "q/internal/x"
|
||||||
|
_ "q/j"
|
||||||
|
)
|
1
src/cmd/go/testdata/testinternal4/src/q/internal/x/x.go
vendored
Normal file
1
src/cmd/go/testdata/testinternal4/src/q/internal/x/x.go
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
package x
|
3
src/cmd/go/testdata/testinternal4/src/q/j/j.go
vendored
Normal file
3
src/cmd/go/testdata/testinternal4/src/q/j/j.go
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
package j
|
||||||
|
|
||||||
|
import _ "q/internal/x"
|
Loading…
Reference in New Issue
Block a user