]> Cypherpunks repositories - gostls13.git/commit
cmd/go: apply import restrictions to test code too
authorRuss Cox <rsc@golang.org>
Fri, 21 Oct 2016 16:04:31 +0000 (12:04 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 28 Oct 2016 20:32:29 +0000 (20:32 +0000)
commit0f06d0a051714d14b923b0a9164ab1b3f463aa74
tree12a02d8998590c57322a7dfa78cbe9447a2587c2
parent91c1cdfbdbecbc33ad396f55d9e8b5619959fde1
cmd/go: apply import restrictions to test code too

We reject import of main packages, but we missed tests.
Reject in all tests except test of that main package.

We reject local (relative) imports from code with a
non-local import path, but again we missed tests.
Reject those too.

Fixes #14811.
Fixes #15795.
Fixes #17475.

Change-Id: I535ff26889520276a891904f54f1a85b2c40207d
Reviewed-on: https://go-review.googlesource.com/31821
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Quentin Smith <quentin@golang.org>
src/cmd/go/go_test.go
src/cmd/go/pkg.go
src/cmd/go/testdata/src/importmain/ismain/main.go [new file with mode: 0644]
src/cmd/go/testdata/src/importmain/test/test.go [new file with mode: 0644]
src/cmd/go/testdata/src/importmain/test/test_test.go [new file with mode: 0644]