| 1 |
# When there is no rationale, 'go get' should print a hard-coded message. |
| 2 |
go get example.com/retract/[email protected] |
| 3 |
stderr '^go: warning: example.com/retract/[email protected]: retracted by module author$' |
| 4 |
|
| 5 |
# 'go list' should print the same hard-coded message. |
| 6 |
go list -m -retracted -f '{{.Retracted}}' example.com/retract/rationale |
| 7 |
stdout '^\[retracted by module author\]$' |
| 8 |
|
| 9 |
|
| 10 |
# When there is a multi-line message, 'go get' should print the first line. |
| 11 |
go get example.com/retract/[email protected] |
| 12 |
stderr '^go: warning: example.com/retract/[email protected]: retracted by module author: short description$' |
| 13 |
! stderr 'detail' |
| 14 |
|
| 15 |
# 'go list' should show the full message. |
| 16 |
go list -m -retracted -f '{{.Retracted}}' example.com/retract/rationale |
| 17 |
cmp stdout multiline |
| 18 |
|
| 19 |
# 'go get' output should be the same whether the retraction appears at top-level |
| 20 |
# or in a block. |
| 21 |
go get example.com/retract/[email protected] |
| 22 |
stderr '^go: warning: example.com/retract/[email protected]: retracted by module author: short description$' |
| 23 |
! stderr 'detail' |
| 24 |
|
| 25 |
# Same for 'go list'. |
| 26 |
go list -m -retracted -f '{{.Retracted}}' example.com/retract/rationale |
| 27 |
cmp stdout multiline |
| 28 |
|
| 29 |
|
| 30 |
# 'go get' should omit long messages. |
| 31 |
go get example.com/retract/[email protected] |
| 32 |
stderr '^go: warning: example.com/retract/[email protected]: retracted by module author: \(message omitted: too long\)' |
| 33 |
|
| 34 |
# 'go list' should show the full message. |
| 35 |
go list -m -retracted -f '{{.Retracted}}' example.com/retract/rationale |
| 36 |
stdout '^\[lo{500}ng\]$' |
| 37 |
|
| 38 |
|
| 39 |
# 'go get' should omit messages with unprintable characters. |
| 40 |
go get example.com/retract/[email protected] |
| 41 |
stderr '^go: warning: example.com/retract/[email protected]: retracted by module author: \(message omitted: contains non-printable characters\)' |
| 42 |
|
| 43 |
# 'go list' should show the full message. |
| 44 |
go list -m -retracted -f '{{.Retracted}}' example.com/retract/rationale |
| 45 |
stdout '^\[Ends with a BEL character. Beep!\x07\]$' |
| 46 |
|
| 47 |
|
| 48 |
# When there is a comment on a block, but not on individual retractions within |
| 49 |
# the block, the rationale should come from the block comment. |
| 50 |
go list -m -retracted -f '{{.Retracted}}' example.com/retract/[email protected] |
| 51 |
stdout '^\[block comment\]$' |
| 52 |
go list -m -retracted -f '{{.Retracted}}' example.com/retract/[email protected] |
| 53 |
stdout '^\[inner comment\]$' |
| 54 |
|
| 55 |
|
| 56 |
# When a version is covered by multiple retractions, all retractions should |
| 57 |
# be reported in the order they appear in the file. |
| 58 |
go list -m -retracted -f '{{range .Retracted}}{{.}},{{end}}' example.com/retract/[email protected] |
| 59 |
stdout '^degenerate range,single version,$' |
| 60 |
go list -m -retracted -f '{{range .Retracted}}{{.}},{{end}}' example.com/retract/[email protected] |
| 61 |
stdout '^single version,degenerate range,$' |
| 62 |
|
| 63 |
# 'go get' will only report the first retraction to avoid being too verbose. |
| 64 |
go get example.com/retract/[email protected] |
| 65 |
stderr '^go: warning: example.com/retract/[email protected]: retracted by module author: degenerate range$' |
| 66 |
go get example.com/retract/[email protected] |
| 67 |
stderr '^go: warning: example.com/retract/[email protected]: retracted by module author: single version$' |
| 68 |
|
| 69 |
-- go.mod -- |
| 70 |
module m |
| 71 |
|
| 72 |
go 1.14 |
| 73 |
|
| 74 |
-- multiline -- |
| 75 |
[short description |
| 76 |
more |
| 77 |
|
| 78 |
detail |
| 79 |
suffix] |