summaryrefslogtreecommitdiffstats
path: root/src/cmd/go/testdata/script/run_internal.txt
blob: d02185017b37a750198c37b181a29679f0dbc297 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
env GO111MODULE=off

go list -e -f '{{.Incomplete}}' m/runbad1.go
stdout true
! go run m/runbad1.go
stderr 'use of internal package m/x/internal not allowed'

go list -e -f '{{.Incomplete}}' m/runbad2.go
stdout true
! go run m/runbad2.go
stderr 'use of internal package m/x/internal/y not allowed'

go list -e -f '{{.Incomplete}}' m/runok.go
stdout false
go run m/runok.go

cd m
env GO111MODULE=on

go list -e -f '{{.Incomplete}}' runbad1.go
stdout true
! go run runbad1.go
stderr 'use of internal package m/x/internal not allowed'

go list -e -f '{{.Incomplete}}' runbad2.go
stdout true
! go run runbad2.go
stderr 'use of internal package m/x/internal/y not allowed'

go list -e -f '{{.Incomplete}}' runok.go
stdout false
go run runok.go


-- m/go.mod --
module m

-- m/x/internal/internal.go --
package internal

-- m/x/internal/y/y.go --
package y

-- m/internal/internal.go --
package internal

-- m/internal/z/z.go --
package z

-- m/runbad1.go --
package main
import _ "m/x/internal"
func main() {}

-- m/runbad2.go --
package main
import _ "m/x/internal/y"
func main() {}

-- m/runok.go --
package main
import _ "m/internal"
import _ "m/internal/z"
func main() {}