Skip to content

Commit

Permalink
cmd/go: add a test case that reproduces #44296
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bryan C. Mills committed Mar 2, 2021
1 parent e9eed78 commit b65091c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/cmd/go/testdata/script/mod_retract_versions.txt
Original file line number Diff line number Diff line change
@@ -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"$'

0 comments on commit b65091c

Please sign in to comment.