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.
3 cp go.mod.allreplaced go.mod
4 go list -m -u -f '{{.Path}}@{{.Version}} <{{.Deprecated}}>{{with .Replace}} => {{.Path}}@{{.Version}} <{{.Deprecated}}>{{end}}' all
5 stdout '^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.
8 cp go.mod.onereplaced go.mod
9 go list -m -u -f '{{.Path}}@{{.Version}} <{{.Deprecated}}>{{with .Replace}} => {{.Path}}@{{.Version}} <{{.Deprecated}}>{{end}}' all
10 stdout '^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.
13 cp go.mod.dirreplacement go.mod
14 go list -m -u -f '{{.Path}}@{{.Version}} <{{.Deprecated}}>{{with .Replace}} => {{.Path}}@{{.Version}} <{{.Deprecated}}>{{end}}' all
15 stdout '^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.
19 cp go.mod.latestreplaced go.mod
20 go list -m -u -f '{{.Path}}@{{.Version}} <{{.Deprecated}}>{{with .Replace}} => {{.Path}}@{{.Version}} <{{.Deprecated}}>{{end}}' all
21 stdout '^example.com/deprecated/a@v1.0.0 <> => example.com/deprecated/b@v1.0.0 <in ./b>$'
22
23 -- go.mod.allreplaced --
24 module m
25
26 go 1.17
27
28 require example.com/deprecated/a v1.0.0
29
30 replace example.com/deprecated/a => example.com/deprecated/b v1.0.0
31 -- go.mod.onereplaced --
32 module m
33
34 go 1.17
35
36 require example.com/deprecated/a v1.0.0
37
38 replace example.com/deprecated/a v1.0.0 => example.com/deprecated/b v1.0.0
39 -- go.mod.dirreplacement --
40 module m
41
42 go 1.17
43
44 require example.com/deprecated/a v1.0.0
45
46 replace example.com/deprecated/a => ./a
47 -- go.mod.latestreplaced --
48 module m
49
50 go 1.17
51
52 require example.com/deprecated/a v1.0.0
53
54 replace (
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 --
59 example.com/deprecated/b v1.0.0/go.mod h1:b19J9ywRGviY7Nq4aJ1WBJ+A7qUlEY9ihp22yI4/F6M=
60 -- a/go.mod --
61 module example.com/deprecated/a
62
63 go 1.17
64 -- b/go.mod --
65 // Deprecated: in ./b
66 module example.com/deprecated/b
67
68 go 1.17
69
View as plain text