...
1# When there is no rationale, 'go get' should print a hard-coded message.
2go get example.com/retract/rationale@v1.0.0-empty
3stderr '^go: warning: example.com/retract/rationale@v1.0.0-empty: retracted by module author$'
4
5# 'go list' should print the same hard-coded message.
6go list -m -retracted -f '{{.Retracted}}' example.com/retract/rationale
7stdout '^\[retracted by module author\]$'
8
9
10# When there is a multi-line message, 'go get' should print the first line.
11go get example.com/retract/rationale@v1.0.0-multiline1
12stderr '^go: warning: example.com/retract/rationale@v1.0.0-multiline1: retracted by module author: short description$'
13! stderr 'detail'
14
15# 'go list' should show the full message.
16go list -m -retracted -f '{{.Retracted}}' example.com/retract/rationale
17cmp stdout multiline
18
19# 'go get' output should be the same whether the retraction appears at top-level
20# or in a block.
21go get example.com/retract/rationale@v1.0.0-multiline2
22stderr '^go: warning: example.com/retract/rationale@v1.0.0-multiline2: retracted by module author: short description$'
23! stderr 'detail'
24
25# Same for 'go list'.
26go list -m -retracted -f '{{.Retracted}}' example.com/retract/rationale
27cmp stdout multiline
28
29
30# 'go get' should omit long messages.
31go get example.com/retract/rationale@v1.0.0-long
32stderr '^go: warning: example.com/retract/rationale@v1.0.0-long: retracted by module author: \(message omitted: too long\)'
33
34# 'go list' should show the full message.
35go list -m -retracted -f '{{.Retracted}}' example.com/retract/rationale
36stdout '^\[lo{500}ng\]$'
37
38
39# 'go get' should omit messages with unprintable characters.
40go get example.com/retract/rationale@v1.0.0-unprintable
41stderr '^go: warning: example.com/retract/rationale@v1.0.0-unprintable: retracted by module author: \(message omitted: contains non-printable characters\)'
42
43# 'go list' should show the full message.
44go list -m -retracted -f '{{.Retracted}}' example.com/retract/rationale
45stdout '^\[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.
50go list -m -retracted -f '{{.Retracted}}' example.com/retract/rationale@v1.0.0-block
51stdout '^\[block comment\]$'
52go list -m -retracted -f '{{.Retracted}}' example.com/retract/rationale@v1.0.0-blockwithcomment
53stdout '^\[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.
58go list -m -retracted -f '{{range .Retracted}}{{.}},{{end}}' example.com/retract/rationale@v1.0.0-order
59stdout '^degenerate range,single version,$'
60go list -m -retracted -f '{{range .Retracted}}{{.}},{{end}}' example.com/retract/rationale@v1.0.1-order
61stdout '^single version,degenerate range,$'
62
63# 'go get' will only report the first retraction to avoid being too verbose.
64go get example.com/retract/rationale@v1.0.0-order
65stderr '^go: warning: example.com/retract/rationale@v1.0.0-order: retracted by module author: degenerate range$'
66go get example.com/retract/rationale@v1.0.1-order
67stderr '^go: warning: example.com/retract/rationale@v1.0.1-order: retracted by module author: single version$'
68
69-- go.mod --
70module m
71
72go 1.14
73
74-- multiline --
75[short description
76more
77
78detail
79suffix]
View as plain text