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