File: //opt/golang/1.22.0/src/cmd/go/testdata/script/mod_retract_rationale.txt
# When there is no rationale, 'go get' should print a hard-coded message.
go get example.com/retract/[email protected]
stderr '^go: warning: example.com/retract/[email protected]: retracted by module author$'
# 'go list' should print the same hard-coded message.
go list -m -retracted -f '{{.Retracted}}' example.com/retract/rationale
stdout '^\[retracted by module author\]$'
# When there is a multi-line message, 'go get' should print the first line.
go get example.com/retract/[email protected]
stderr '^go: warning: example.com/retract/[email protected]: retracted by module author: short description$'
! stderr 'detail'
# 'go list' should show the full message.
go list -m -retracted -f '{{.Retracted}}' example.com/retract/rationale
cmp stdout multiline
# 'go get' output should be the same whether the retraction appears at top-level
# or in a block.
go get example.com/retract/[email protected]
stderr '^go: warning: example.com/retract/[email protected]: retracted by module author: short description$'
! stderr 'detail'
# Same for 'go list'.
go list -m -retracted -f '{{.Retracted}}' example.com/retract/rationale
cmp stdout multiline
# 'go get' should omit long messages.
go get example.com/retract/[email protected]
stderr '^go: warning: example.com/retract/[email protected]: retracted by module author: \(message omitted: too long\)'
# 'go list' should show the full message.
go list -m -retracted -f '{{.Retracted}}' example.com/retract/rationale
stdout '^\[lo{500}ng\]$'
# 'go get' should omit messages with unprintable characters.
go get example.com/retract/[email protected]
stderr '^go: warning: example.com/retract/[email protected]: retracted by module author: \(message omitted: contains non-printable characters\)'
# 'go list' should show the full message.
go list -m -retracted -f '{{.Retracted}}' example.com/retract/rationale
stdout '^\[Ends with a BEL character. Beep!\x07\]$'
# When there is a comment on a block, but not on individual retractions within
# the block, the rationale should come from the block comment.
go list -m -retracted -f '{{.Retracted}}' example.com/retract/[email protected]
stdout '^\[block comment\]$'
go list -m -retracted -f '{{.Retracted}}' example.com/retract/[email protected]
stdout '^\[inner comment\]$'
# When a version is covered by multiple retractions, all retractions should
# be reported in the order they appear in the file.
go list -m -retracted -f '{{range .Retracted}}{{.}},{{end}}' example.com/retract/[email protected]
stdout '^degenerate range,single version,$'
go list -m -retracted -f '{{range .Retracted}}{{.}},{{end}}' example.com/retract/[email protected]
stdout '^single version,degenerate range,$'
# 'go get' will only report the first retraction to avoid being too verbose.
go get example.com/retract/[email protected]
stderr '^go: warning: example.com/retract/[email protected]: retracted by module author: degenerate range$'
go get example.com/retract/[email protected]
stderr '^go: warning: example.com/retract/[email protected]: retracted by module author: single version$'
-- go.mod --
module m
go 1.14
-- multiline --
[short description
more
detail
suffix]