1 # example.net/pkgremoved@v0.1.0 refers to a package.
2 go get example.net/pkgremoved@v0.1.0
3
4 go list example.net/pkgremoved
5 stdout '^example.net/pkgremoved'
6
7 cp go.mod go.mod.orig
8
9
10 # When we resolve a new dependency on example.net/other,
11 # it will change the meaning of the path "example.net/pkgremoved"
12 # from a package (at v0.1.0) to only a module (at v0.2.0).
13 #
14 # If we simultaneously 'get' that module at the query "patch", the module should
15 # be constrained to the latest patch of its originally-selected version (v0.1.0),
16 # not upgraded to the latest patch of the new transitive dependency.
17
18 ! go get example.net/pkgremoved@patch example.net/other@v0.1.0
19 stderr '^go: example.net/other@v0.1.0 requires example.net/pkgremoved@v0.2.0, not example.net/pkgremoved@patch \(v0.1.1\)$'
20 cmp go.mod.orig go.mod
21
22
23 # However, we should be able to patch from a package to a module and vice-versa.
24
25 # Package to module ...
26
27 go get example.net/pkgremoved@v0.3.0
28 go list example.net/pkgremoved
29 stdout 'example.net/pkgremoved'
30
31 go get example.net/pkgremoved@patch
32 ! go list example.net/pkgremoved
33
34 # ... and module to package.
35
36 go get example.net/pkgremoved@v0.4.0
37 ! go list example.net/pkgremoved
38
39 go get example.net/pkgremoved@patch
40 go list example.net/pkgremoved
41 stdout 'example.net/pkgremoved'
42
43
44 -- go.mod --
45 module example
46
47 go 1.16
48
49 replace (
50 example.net/other v0.1.0 => ./other
51
52 example.net/pkgremoved v0.1.0 => ./prpkg
53 example.net/pkgremoved v0.1.1 => ./prpkg
54
55 example.net/pkgremoved v0.2.0 => ./prmod
56 example.net/pkgremoved v0.2.1 => ./prmod
57
58 example.net/pkgremoved v0.3.0 => ./prpkg
59 example.net/pkgremoved v0.3.1 => ./prmod
60
61 example.net/pkgremoved v0.4.0 => ./prmod
62 example.net/pkgremoved v0.4.1 => ./prpkg
63 )
64 -- other/go.mod --
65 module example.net/other
66
67 go 1.16
68
69 require example.net/pkgremoved v0.2.0
70 -- other/other.go --
71 package other
72 -- prpkg/go.mod --
73 module example.net/pkgremoved
74
75 go 1.16
76 -- prpkg/pkgremoved.go --
77 package pkgremoved
78 -- prmod/go.mod --
79 module example.net/pkgremoved
80 -- prmod/README.txt --
81 Package pkgremoved was removed in v0.2.0 and v0.3.1,
82 and added in v0.1.0 and v0.4.1.
83
View as plain text