...

Text file src/cmd/go/testdata/script/mod_get_retract.txt

Documentation: cmd/go/testdata/script

     1# 'go get pkg' should not upgrade to a retracted version.
     2cp go.mod.orig go.mod
     3go mod edit -require example.com/retract/self/prev@v1.1.0
     4go get example.com/retract/self/prev
     5go list -m example.com/retract/self/prev
     6stdout '^example.com/retract/self/prev v1.1.0$'
     7
     8# 'go get pkg' should not downgrade from a retracted version when no higher
     9# version is available.
    10cp go.mod.orig go.mod
    11go mod edit -require example.com/retract/self/prev@v1.9.0
    12go get example.com/retract/self/prev
    13stderr '^go: warning: example.com/retract/self/prev@v1.9.0: retracted by module author: self$'
    14stderr '^go: to switch to the latest unretracted version, run:\n\tgo get example.com/retract/self/prev@latest\n$'
    15go list -m example.com/retract/self/prev
    16stdout '^example.com/retract/self/prev v1.9.0$'
    17
    18# 'go get pkg@latest' should downgrade from a retracted version.
    19cp go.mod.orig go.mod
    20go mod edit -require example.com/retract/self/prev@v1.9.0
    21go get example.com/retract/self/prev@latest
    22go list -m example.com/retract/self/prev
    23stdout '^example.com/retract/self/prev v1.1.0$'
    24
    25# 'go get pkg@version' should update to a specific version, even if that
    26# version is retracted.
    27cp go.mod.orig go.mod
    28go get example.com/retract@v1.0.0-bad
    29stderr '^go: warning: example.com/retract@v1.0.0-bad: retracted by module author: bad$'
    30go list -m example.com/retract
    31stdout '^example.com/retract v1.0.0-bad$'
    32
    33# 'go get -u' should not downgrade from a retracted version when no higher
    34# version is available.
    35cp go.mod.orig go.mod
    36go mod edit -require example.com/retract/self/prev@v1.9.0
    37go get -u ./use
    38stderr '^go: warning: example.com/retract/self/prev@v1.9.0: retracted by module author: self$'
    39go list -m example.com/retract/self/prev
    40stdout '^example.com/retract/self/prev v1.9.0$'
    41
    42# 'go get' should warn if a module needed to build named packages is retracted.
    43# 'go get' should not warn about unrelated modules.
    44go get ./empty
    45! stderr retracted
    46go get ./use
    47stderr '^go: warning: example.com/retract/self/prev@v1.9.0: retracted by module author: self$'
    48
    49-- go.mod.orig --
    50module example.com/use
    51
    52go 1.15
    53
    54-- use/use.go --
    55package use
    56
    57import _ "example.com/retract/self/prev"
    58-- empty/empty.go --
    59package empty

View as plain text