0% found this document useful (0 votes)
2 views2 pages

Go Module Rationale Retraction Handling

The document outlines the expected behavior of the 'go get' and 'go list' commands when dealing with retracted modules, specifying how messages should be formatted based on the presence of rationale. It details how to handle various scenarios such as multi-line messages, long messages, and unprintable characters, ensuring that 'go get' provides concise warnings while 'go list' shows full details. Additionally, it describes how to manage multiple retractions and comments associated with blocks of retractions.

Uploaded by

abiysosina
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Go Module Rationale Retraction Handling

The document outlines the expected behavior of the 'go get' and 'go list' commands when dealing with retracted modules, specifying how messages should be formatted based on the presence of rationale. It details how to handle various scenarios such as multi-line messages, long messages, and unprintable characters, ensuring that 'go get' provides concise warnings while 'go list' shows full details. Additionally, it describes how to manage multiple retractions and comments associated with blocks of retractions.

Uploaded by

abiysosina
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

# When there is no rationale, 'go get' should print a hard-coded message.

go get [Link]/retract/rationale@v1.0.0-empty
stderr '^go: warning: [Link]/retract/rationale@v1.0.0-empty: retracted by
module author$'

# 'go list' should print the same hard-coded message.


go list -m -retracted -f '{{.Retracted}}' [Link]/retract/rationale
stdout '^\[retracted by module author\]$'

# When there is a multi-line message, 'go get' should print the first line.
go get [Link]/retract/rationale@v1.0.0-multiline1
stderr '^go: warning: [Link]/retract/rationale@v1.0.0-multiline1: retracted by
module author: short description$'
! stderr 'detail'

# 'go list' should show the full message.


go list -m -retracted -f '{{.Retracted}}' [Link]/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 [Link]/retract/rationale@v1.0.0-multiline2
stderr '^go: warning: [Link]/retract/rationale@v1.0.0-multiline2: retracted by
module author: short description$'
! stderr 'detail'

# Same for 'go list'.


go list -m -retracted -f '{{.Retracted}}' [Link]/retract/rationale
cmp stdout multiline

# 'go get' should omit long messages.


go get [Link]/retract/rationale@v1.0.0-long
stderr '^go: warning: [Link]/retract/rationale@v1.0.0-long: retracted by
module author: \(message omitted: too long\)'

# 'go list' should show the full message.


go list -m -retracted -f '{{.Retracted}}' [Link]/retract/rationale
stdout '^\[lo{500}ng\]$'

# 'go get' should omit messages with unprintable characters.


go get [Link]/retract/rationale@v1.0.0-unprintable
stderr '^go: warning: [Link]/retract/rationale@v1.0.0-unprintable: retracted
by module author: \(message omitted: contains non-printable characters\)'

# 'go list' should show the full message.


go list -m -retracted -f '{{.Retracted}}' [Link]/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}}' [Link]/retract/rationale@v1.0.0-
block
stdout '^\[block comment\]$'
go list -m -retracted -f '{{.Retracted}}' [Link]/retract/rationale@v1.0.0-
blockwithcomment
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}}'
[Link]/retract/rationale@v1.0.0-order
stdout '^degenerate range,single version,$'
go list -m -retracted -f '{{range .Retracted}}{{.}},{{end}}'
[Link]/retract/rationale@v1.0.1-order
stdout '^single version,degenerate range,$'

# 'go get' will only report the first retraction to avoid being too verbose.
go get [Link]/retract/rationale@v1.0.0-order
stderr '^go: warning: [Link]/retract/rationale@v1.0.0-order: retracted by
module author: degenerate range$'
go get [Link]/retract/rationale@v1.0.1-order
stderr '^go: warning: [Link]/retract/rationale@v1.0.1-order: retracted by
module author: single version$'

-- [Link] --
module m

go 1.14

-- multiline --
[short description
more

detail
suffix]

You might also like