...
Text file
src/cmd/go/testdata/script/mod_list_deprecated_replace.txt
1# When all versions are replaced, we should not look up a deprecation message.
2# We will still look up a deprecation message for the replacement.
3cp go.mod.allreplaced go.mod
4go list -m -u -f '{{.Path}}@{{.Version}} <{{.Deprecated}}>{{with .Replace}} => {{.Path}}@{{.Version}} <{{.Deprecated}}>{{end}}' all
5stdout '^example.com/deprecated/a@v1.0.0 <> => example.com/deprecated/b@v1.0.0 <in example.com/deprecated/b@v1.9.0>$'
6
7# When one version is replaced, we should see a deprecation message.
8cp go.mod.onereplaced go.mod
9go list -m -u -f '{{.Path}}@{{.Version}} <{{.Deprecated}}>{{with .Replace}} => {{.Path}}@{{.Version}} <{{.Deprecated}}>{{end}}' all
10stdout '^example.com/deprecated/a@v1.0.0 <in example.com/deprecated/a@v1.9.0> => example.com/deprecated/b@v1.0.0 <in example.com/deprecated/b@v1.9.0>$'
11
12# If the replacement is a directory, we won't look that up.
13cp go.mod.dirreplacement go.mod
14go list -m -u -f '{{.Path}}@{{.Version}} <{{.Deprecated}}>{{with .Replace}} => {{.Path}}@{{.Version}} <{{.Deprecated}}>{{end}}' all
15stdout '^example.com/deprecated/a@v1.0.0 <> => ./a@ <>$'
16
17# If the latest version of the replacement is replaced, we'll use the content
18# from that replacement.
19cp go.mod.latestreplaced go.mod
20go list -m -u -f '{{.Path}}@{{.Version}} <{{.Deprecated}}>{{with .Replace}} => {{.Path}}@{{.Version}} <{{.Deprecated}}>{{end}}' all
21stdout '^example.com/deprecated/a@v1.0.0 <> => example.com/deprecated/b@v1.0.0 <in ./b>$'
22
23-- go.mod.allreplaced --
24module m
25
26go 1.17
27
28require example.com/deprecated/a v1.0.0
29
30replace example.com/deprecated/a => example.com/deprecated/b v1.0.0
31-- go.mod.onereplaced --
32module m
33
34go 1.17
35
36require example.com/deprecated/a v1.0.0
37
38replace example.com/deprecated/a v1.0.0 => example.com/deprecated/b v1.0.0
39-- go.mod.dirreplacement --
40module m
41
42go 1.17
43
44require example.com/deprecated/a v1.0.0
45
46replace example.com/deprecated/a => ./a
47-- go.mod.latestreplaced --
48module m
49
50go 1.17
51
52require example.com/deprecated/a v1.0.0
53
54replace (
55 example.com/deprecated/a => example.com/deprecated/b v1.0.0
56 example.com/deprecated/b v1.9.0 => ./b
57)
58-- go.sum --
59example.com/deprecated/b v1.0.0/go.mod h1:b19J9ywRGviY7Nq4aJ1WBJ+A7qUlEY9ihp22yI4/F6M=
60-- a/go.mod --
61module example.com/deprecated/a
62
63go 1.17
64-- b/go.mod --
65// Deprecated: in ./b
66module example.com/deprecated/b
67
68go 1.17
View as plain text