From d72dce87837c96f875d5fa2e26159ef211bce3a0 Mon Sep 17 00:00:00 2001 From: Jay Conrod Date: Tue, 26 Nov 2019 17:07:26 -0500 Subject: [PATCH] cmd/go: test that 'go list -e -mod=readonly' reports errors correctly This issue was fixed by earlier improvements to error handling when loading modules. Fixes #34829 Change-Id: I4cf4e182a7381f8b5c359179d90bd02491ea7911 Reviewed-on: https://go-review.googlesource.com/c/go/+/209037 Run-TryBot: Jay Conrod TryBot-Result: Gobot Gobot Reviewed-by: Bryan C. Mills --- .../go/testdata/script/mod_list_e_readonly.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/cmd/go/testdata/script/mod_list_e_readonly.txt diff --git a/src/cmd/go/testdata/script/mod_list_e_readonly.txt b/src/cmd/go/testdata/script/mod_list_e_readonly.txt new file mode 100644 index 0000000000..5baeea2497 --- /dev/null +++ b/src/cmd/go/testdata/script/mod_list_e_readonly.txt @@ -0,0 +1,15 @@ +# 'go list -mod=readonly -e should attribute errors +# to individual missing packages. +# Verifies golang.org/issue/34829. +go list -mod=readonly -e -deps -f '{{if .Error}}{{.ImportPath}}: {{.Error}}{{end}}' . +stdout 'example.com/missing: use.go:3:8: import lookup disabled by -mod=readonly' + +-- go.mod -- +module example.com/m + +go 1.14 + +-- use.go -- +package use + +import _ "example.com/missing" -- 2.50.0