summaryrefslogtreecommitdiffstats
path: root/src/cmd/go/testdata/script/run_internal.txt
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:23:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:23:18 +0000
commit43a123c1ae6613b3efeed291fa552ecd909d3acf (patch)
treefd92518b7024bc74031f78a1cf9e454b65e73665 /src/cmd/go/testdata/script/run_internal.txt
parentInitial commit. (diff)
downloadgolang-1.20-43a123c1ae6613b3efeed291fa552ecd909d3acf.tar.xz
golang-1.20-43a123c1ae6613b3efeed291fa552ecd909d3acf.zip
Adding upstream version 1.20.14.upstream/1.20.14upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/cmd/go/testdata/script/run_internal.txt')
-rw-r--r--src/cmd/go/testdata/script/run_internal.txt64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/cmd/go/testdata/script/run_internal.txt b/src/cmd/go/testdata/script/run_internal.txt
new file mode 100644
index 0000000..d021850
--- /dev/null
+++ b/src/cmd/go/testdata/script/run_internal.txt
@@ -0,0 +1,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() {}