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

     1  # 'go get pkg' should not show a deprecation message for an unrelated module.
     2  go get ./use/nothing
     3  ! stderr 'module.*is deprecated'
     4  
     5  # 'go get pkg' should show a deprecation message for the module providing pkg.
     6  go get example.com/deprecated/a
     7  stderr '^go: module example.com/deprecated/a is deprecated: in example.com/deprecated/a@v1.9.0$'
     8  go get example.com/deprecated/a@v1.0.0
     9  stderr '^go: module example.com/deprecated/a is deprecated: in example.com/deprecated/a@v1.9.0$'
    10  
    11  # 'go get pkg' should show a deprecation message for a module providing
    12  # packages directly imported by pkg.
    13  go get ./use/a
    14  stderr '^go: module example.com/deprecated/a is deprecated: in example.com/deprecated/a@v1.9.0$'
    15  
    16  # 'go get pkg' may show a deprecation message for an indirectly required module
    17  # if it provides a package named on the command line.
    18  go get ./use/b
    19  ! stderr 'module.*is deprecated'
    20  go get local/use
    21  ! stderr 'module.*is deprecated'
    22  go get example.com/deprecated/b
    23  stderr '^go: module example.com/deprecated/b is deprecated: in example.com/deprecated/b@v1.9.0$'
    24  
    25  # 'go get pkg' does not show a deprecation message for a module providing a
    26  # directly imported package if the module is no longer deprecated in its
    27  # latest version, even if the module is deprecated in its current version.
    28  go get ./use/undeprecated
    29  ! stderr 'module.*is deprecated'
    30  
    31  -- go.mod --
    32  module m
    33  
    34  go 1.17
    35  
    36  require (
    37  	example.com/deprecated/a v1.0.0
    38  	example.com/undeprecated v1.0.0
    39  	local v0.0.0
    40  )
    41  
    42  replace local v0.0.0 => ./local
    43  -- use/nothing/nothing.go --
    44  package nothing
    45  -- use/a/a.go --
    46  package a
    47  
    48  import _ "example.com/deprecated/a"
    49  -- use/b/b.go --
    50  package b
    51  
    52  import _ "local/use"
    53  -- use/undeprecated/undeprecated.go --
    54  package undeprecated
    55  
    56  import _ "example.com/undeprecated"
    57  -- local/go.mod --
    58  module local
    59  
    60  go 1.17
    61  
    62  require example.com/deprecated/b v1.0.0
    63  -- local/use/use.go --
    64  package use
    65  
    66  import _ "example.com/deprecated/b"
    67  

View as plain text