From a9edda3788b7ff6a73686874c9b3dcb1e5e18b87 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Mon, 3 May 2021 17:03:01 -0400 Subject: [PATCH] cmd/go: add a test that reproduces #45827 For #45827 Change-Id: I4d3268d66fb0927161f44b353faef11aa4551e40 Reviewed-on: https://go-review.googlesource.com/c/go/+/317298 Trust: Bryan C. Mills Run-TryBot: Bryan C. Mills TryBot-Result: Go Bot Reviewed-by: Jay Conrod --- .../go/testdata/script/mod_run_pkgerror.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/cmd/go/testdata/script/mod_run_pkgerror.txt 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 index 0000000000..fd7060aaa8 --- /dev/null +++ b/src/cmd/go/testdata/script/mod_run_pkgerror.txt @@ -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 -- 2.48.1