From b65091c11d711ff3b01cd25393305410e1b0b377 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Fri, 26 Feb 2021 17:21:21 -0500 Subject: [PATCH] cmd/go: add a test case that reproduces #44296 For #44296 Change-Id: I310f99ccd406622e39f3fbfa12f7a3bee39602db Reviewed-on: https://go-review.googlesource.com/c/go/+/297149 Trust: Bryan C. Mills Run-TryBot: Bryan C. Mills TryBot-Result: Go Bot Reviewed-by: Michael Matloob --- .../testdata/script/mod_retract_versions.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/cmd/go/testdata/script/mod_retract_versions.txt diff --git a/src/cmd/go/testdata/script/mod_retract_versions.txt b/src/cmd/go/testdata/script/mod_retract_versions.txt new file mode 100644 index 0000000000..93ce5926e3 --- /dev/null +++ b/src/cmd/go/testdata/script/mod_retract_versions.txt @@ -0,0 +1,18 @@ +# https://golang.org/issue/44296: the --versions flag should not affect +# the version reported by 'go list' in case of retractions. + +env FMT='{{.Path}}{{with .Error}}: {{printf "%q" .Err}}{{end}} {{printf "%q" .Version}}{{with .Versions}} {{.}}{{end}}' + +go list -m -e -f $FMT example.com/retract/self/pseudo +stdout '^example.com/retract/self/pseudo: "module example.com/retract/self/pseudo: not a known dependency" ""$' + +go list -m -e -f $FMT example.com/retract/self/pseudo@latest +stdout '^example.com/retract/self/pseudo: "module example.com/retract/self/pseudo: no matching versions for query \\"latest\\"" "latest"$' + + + # BUG(#44296): Adding --versions should not cause a retracted version to be reported. +go list -m -e -f $FMT --versions example.com/retract/self/pseudo +stdout '^example.com/retract/self/pseudo "v1.9.0"$' + +go list -m -e -f $FMT --versions example.com/retract/self/pseudo@latest +stdout '^example.com/retract/self/pseudo: "module example.com/retract/self/pseudo: no matching versions for query \\"latest\\"" "latest"$'