]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: expand 'internal' rule to all repositories
authorRuss Cox <rsc@golang.org>
Mon, 20 Apr 2015 17:45:56 +0000 (13:45 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 3 Jun 2015 20:27:25 +0000 (20:27 +0000)
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>
src/cmd/go/pkg.go
src/cmd/go/test.bash

index 601c30362ff2592e65950dda5b5ae392f730c948..8abddecd18014ae0b9180ad95a80333c177a3a0e 100644 (file)
@@ -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
index 1dabc14a4ad1709ab33f11a05e391e0061f07c28..1d79a3bea66401b31615d5cc7ee945619698f22a 100755 (executable)
@@ -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