blob: 6f520c7720d2fee618d1eeb5dcef0d2b4c000503 [file] [log] [blame]
env GO111MODULE=on
cd foo
# Testing an explicit source file should use the same import visibility as the
# package in the same directory.
go list -test -deps
go list -test -deps foo_test.go
# If the file is inside the main module's vendor directory, it should have
# visibility based on the vendor-relative import path.
mkdir vendor/
cp foo_test.go vendor/
go list -test -deps vendor/
# If the file is outside the main module entirely, it should be treated as outside.
cp foo_test.go ../foo_test.go
! go list -test -deps ../foo_test.go
stderr 'use of internal package'
-- foo/go.mod --
go 1.12
require v0.0.0
replace => ../internal
-- foo/internal.go --
package foo
import _ ""
-- foo/foo_test.go --
package foo_test
import (
func TestHacksEnabled(t *testing.T) {
if !internal.Hacks {
t.Fatal("hacks not enabled")
-- internal/go.mod --
-- internal/internal.go --
package internal
const Hacks = true