mirror of
https://github.com/golang/go
synced 2024-11-18 08:54:45 -07:00
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/9156 Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
parent
3be7f28e82
commit
8f0cc6c0d8
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user