]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: add a test that reproduces #45827
authorBryan C. Mills <bcmills@google.com>
Mon, 3 May 2021 21:03:01 +0000 (17:03 -0400)
committerBryan C. Mills <bcmills@google.com>
Mon, 10 May 2021 15:47:52 +0000 (15:47 +0000)
For #45827

Change-Id: I4d3268d66fb0927161f44b353faef11aa4551e40
Reviewed-on: https://go-review.googlesource.com/c/go/+/317298
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/testdata/script/mod_run_pkgerror.txt [new file with mode: 0644]

diff --git a/src/cmd/go/testdata/script/mod_run_pkgerror.txt b/src/cmd/go/testdata/script/mod_run_pkgerror.txt
new file mode 100644 (file)
index 0000000..fd7060a
--- /dev/null
@@ -0,0 +1,18 @@
+# https://golang.org/issue/45827: 'go run .' should report the same package
+# errors as 'go build'.
+
+! go build
+stderr '^found packages m \(m\.go\) and main \(main\.go\) in '$PWD'$'
+
+! go run .
+       # TODO(#45827): This error should match the above.
+stderr '^go run: no packages loaded from \.$'
+
+-- go.mod --
+module m
+
+go 1.17
+-- m.go --
+package m
+-- main.go --
+package main