Commit 8f0cc6c0 authored by Russ Cox's avatar Russ Cox

cmd/go: expand 'internal' rule to all repositories

See golang.org/s/go14internal.

Fixes #10479.

Change-Id: I8c657dadeb5f10af060f22dedc15c1af989d4519
Reviewed-on: https://go-review.googlesource.com/9156Reviewed-by: default avatarRob Pike <r@golang.org>
parent 3be7f28e
......@@ -322,13 +322,6 @@ func disallowInternal(srcDir string, p *Package, stk *importStack) *Package {
// An import of a path containing the element “internal”
// is disallowed if the importing code is outside the tree
// rooted at the parent of the “internal” directory.
//
// ... For Go 1.4, we will implement the rule first for $GOROOT, but not $GOPATH.
// Only applies to $GOROOT.
if !p.Standard {
return p
}
// The stack includes p.ImportPath.
// If that's the only thing on the stack, we started
......
......@@ -156,9 +156,13 @@ elif ! grep 'use of internal package not allowed' testdata/std.out >/dev/null; t
ok=false
fi
TEST 'internal packages outside $GOROOT are not respected'
if ! ./testgo build -v ./testdata/testinternal2; then
echo "go build ./testdata/testinternal2 failed"
TEST 'internal packages outside $GOROOT are respected (as of Go 1.5)'
if ./testgo build -v ./testdata/testinternal2 >testdata/std.out 2>&1; then
echo "go build ./testdata/testinternal2 succeeded incorrectly"
ok=false
elif ! grep 'use of internal package not allowed' testdata/std.out >/dev/null; then
echo "wrong error message for testdata/testinternal2"
cat std.out
ok=false
fi
......
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