1 env GO111MODULE=off
2
3 go list -e -f '{{.Incomplete}}' m/runbad1.go
4 stdout true
5 ! go run m/runbad1.go
6 stderr 'use of internal package m/x/internal not allowed'
7
8 go list -e -f '{{.Incomplete}}' m/runbad2.go
9 stdout true
10 ! go run m/runbad2.go
11 stderr 'use of internal package m/x/internal/y not allowed'
12
13 go list -e -f '{{.Incomplete}}' m/runok.go
14 stdout false
15 go run m/runok.go
16
17 cd m
18 env GO111MODULE=on
19
20 go list -e -f '{{.Incomplete}}' runbad1.go
21 stdout true
22 ! go run runbad1.go
23 stderr 'use of internal package m/x/internal not allowed'
24
25 go list -e -f '{{.Incomplete}}' runbad2.go
26 stdout true
27 ! go run runbad2.go
28 stderr 'use of internal package m/x/internal/y not allowed'
29
30 go list -e -f '{{.Incomplete}}' runok.go
31 stdout false
32 go run runok.go
33
34
35 -- m/go.mod --
36 module m
37
38 -- m/x/internal/internal.go --
39 package internal
40
41 -- m/x/internal/y/y.go --
42 package y
43
44 -- m/internal/internal.go --
45 package internal
46
47 -- m/internal/z/z.go --
48 package z
49
50 -- m/runbad1.go --
51 package main
52 import _ "m/x/internal"
53 func main() {}
54
55 -- m/runbad2.go --
56 package main
57 import _ "m/x/internal/y"
58 func main() {}
59
60 -- m/runok.go --
61 package main
62 import _ "m/internal"
63 import _ "m/internal/z"
64 func main() {}
65
View as plain text