...

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

Documentation: cmd/go/testdata/script

     1# 'go list pkg' does not show deprecation.
     2go list example.com/deprecated/a
     3stdout '^example.com/deprecated/a$'
     4
     5# 'go list -m' does not show deprecation.
     6go list -m example.com/deprecated/a
     7stdout '^example.com/deprecated/a v1.9.0$'
     8
     9# 'go list -m -versions' does not show deprecation.
    10go list -m -versions example.com/deprecated/a
    11stdout '^example.com/deprecated/a v1.0.0 v1.9.0$'
    12
    13# 'go list -m -u' shows deprecation.
    14go list -m -u example.com/deprecated/a
    15stdout '^example.com/deprecated/a v1.9.0 \(deprecated\)$'
    16
    17# 'go list -m -u -f' exposes the deprecation message.
    18go list -m -u -f {{.Deprecated}} example.com/deprecated/a
    19stdout '^in example.com/deprecated/a@v1.9.0$'
    20
    21# This works even if we use an old version that does not have the deprecation
    22# message in its go.mod file.
    23go get example.com/deprecated/a@v1.0.0
    24! grep Deprecated: $WORK/gopath/pkg/mod/cache/download/example.com/deprecated/a/@v/v1.0.0.mod
    25go list -m -u -f {{.Deprecated}} example.com/deprecated/a
    26stdout '^in example.com/deprecated/a@v1.9.0$'
    27
    28# 'go list -m -u' does not show deprecation for the main module.
    29go list -m -u
    30! stdout deprecated
    31go list -m -u -f '{{if not .Deprecated}}ok{{end}}'
    32stdout ok
    33
    34# 'go list -m -u' does not show a deprecation message for a module that is not
    35# deprecated at the latest version, even if it is deprecated at the current
    36# version.
    37go list -m -u example.com/undeprecated
    38stdout '^example.com/undeprecated v1.0.0 \[v1.0.1\]$'
    39-- go.mod --
    40// Deprecated: main module is deprecated, too!
    41module example.com/use
    42
    43go 1.17
    44
    45require (
    46	example.com/deprecated/a v1.9.0
    47	example.com/undeprecated v1.0.0
    48)
    49-- go.sum --
    50example.com/deprecated/a v1.9.0 h1:HeC7d0lb7umZa0vCCW+0W3WtBTulO+1Mr32m/Hwzeg8=
    51example.com/deprecated/a v1.9.0/go.mod h1:Z1uUVshSY9kh6l/2hZ8oA9SBviX2yfaeEpcLDz6AZwY=
    52example.com/undeprecated v1.0.0/go.mod h1:1qiRbdA9VzJXDqlG26Y41O5Z7YyO+jAD9do8XCZQ+Gg=

View as plain text