1
0
mirror of https://github.com/golang/go synced 2024-11-22 21:30:02 -07:00

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 <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
Bryan C. Mills 2021-02-26 17:21:21 -05:00
parent e9eed78dc3
commit b65091c11d

View File

@ -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"$'