...

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

Documentation: cmd/go/testdata/script

     1# 'go get pkg' should not show a deprecation message for an unrelated module.
     2go get ./use/nothing
     3! stderr 'module.*is deprecated'
     4
     5# 'go get pkg' should show a deprecation message for the module providing pkg.
     6go get example.com/deprecated/a
     7stderr '^go: module example.com/deprecated/a is deprecated: in example.com/deprecated/a@v1.9.0$'
     8go get example.com/deprecated/a@v1.0.0
     9stderr '^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.
    13go get ./use/a
    14stderr '^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.
    18go get ./use/b
    19! stderr 'module.*is deprecated'
    20go get local/use
    21! stderr 'module.*is deprecated'
    22go get example.com/deprecated/b
    23stderr '^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.
    28go get ./use/undeprecated
    29! stderr 'module.*is deprecated'
    30
    31-- go.mod --
    32module m
    33
    34go 1.17
    35
    36require (
    37	example.com/deprecated/a v1.0.0
    38	example.com/undeprecated v1.0.0
    39	local v0.0.0
    40)
    41
    42replace local v0.0.0 => ./local
    43-- use/nothing/nothing.go --
    44package nothing
    45-- use/a/a.go --
    46package a
    47
    48import _ "example.com/deprecated/a"
    49-- use/b/b.go --
    50package b
    51
    52import _ "local/use"
    53-- use/undeprecated/undeprecated.go --
    54package undeprecated
    55
    56import _ "example.com/undeprecated"
    57-- local/go.mod --
    58module local
    59
    60go 1.17
    61
    62require example.com/deprecated/b v1.0.0
    63-- local/use/use.go --
    64package use
    65
    66import _ "example.com/deprecated/b"

View as plain text