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

     1  # 'go list pkg' does not show deprecation.
     2  go list example.com/deprecated/a
     3  stdout '^example.com/deprecated/a$'
     4  
     5  # 'go list -m' does not show deprecation.
     6  go list -m example.com/deprecated/a
     7  stdout '^example.com/deprecated/a v1.9.0$'
     8  
     9  # 'go list -m -versions' does not show deprecation.
    10  go list -m -versions example.com/deprecated/a
    11  stdout '^example.com/deprecated/a v1.0.0 v1.9.0$'
    12  
    13  # 'go list -m -u' shows deprecation.
    14  go list -m -u example.com/deprecated/a
    15  stdout '^example.com/deprecated/a v1.9.0 \(deprecated\)$'
    16  
    17  # 'go list -m -u -f' exposes the deprecation message.
    18  go list -m -u -f {{.Deprecated}} example.com/deprecated/a
    19  stdout '^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.
    23  go 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
    25  go list -m -u -f {{.Deprecated}} example.com/deprecated/a
    26  stdout '^in example.com/deprecated/a@v1.9.0$'
    27  
    28  # 'go list -m -u' does not show deprecation for the main module.
    29  go list -m -u
    30  ! stdout deprecated
    31  go list -m -u -f '{{if not .Deprecated}}ok{{end}}'
    32  stdout 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.
    37  go list -m -u example.com/undeprecated
    38  stdout '^example.com/undeprecated v1.0.0 \[v1.0.1\]$'
    39  -- go.mod --
    40  // Deprecated: main module is deprecated, too!
    41  module example.com/use
    42  
    43  go 1.17
    44  
    45  require (
    46  	example.com/deprecated/a v1.9.0
    47  	example.com/undeprecated v1.0.0
    48  )
    49  -- go.sum --
    50  example.com/deprecated/a v1.9.0 h1:pRyvBIZheJpQVVnNW4Fdg8QuoqDgtkCreqZZbASV3BE=
    51  example.com/deprecated/a v1.9.0/go.mod h1:Z1uUVshSY9kh6l/2hZ8oA9SBviX2yfaeEpcLDz6AZwY=
    52  example.com/undeprecated v1.0.0/go.mod h1:1qiRbdA9VzJXDqlG26Y41O5Z7YyO+jAD9do8XCZQ+Gg=
    53  

View as plain text