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