...
1# This test covers a crazy edge-case involving wildcards and multiple passes of
2# patch-upgrades, but if we get it right we probably get many other edge-cases
3# right too.
4
5go list -m all
6stdout '^example.net/a v0.1.0 '
7! stdout '^example.net/b '
8
9
10# Requesting pattern example.../b by itself fails: there is no such module
11# already in the build list, and the wildcard in the first element prevents us
12# from attempting to resolve a new module whose path is a prefix of the pattern.
13
14! go get -u=patch example.../b@upgrade
15stderr '^go: no modules to query for example\.\.\./b@upgrade because first path element contains a wildcard$'
16
17
18# Patching . causes a patch to example.net/a, which introduces a new match
19# for example.net/b/..., which is itself patched and causes another upgrade to
20# example.net/a, which is then patched again.
21
22go get -u=patch . example.../b@upgrade
23go list -m all
24stdout '^example.net/a v0.2.1 ' # upgraded by dependency of b and -u=patch
25stdout '^example.net/b v0.2.0 ' # introduced by patch of a and upgraded by wildcard
26
27
28-- go.mod --
29module example
30
31go 1.16
32
33require example.net/a v0.1.0
34
35replace (
36 example.net/a v0.1.0 => ./a10
37 example.net/a v0.1.1 => ./a11
38 example.net/a v0.2.0 => ./a20
39 example.net/a v0.2.1 => ./a20
40 example.net/b v0.1.0 => ./b1
41 example.net/b v0.1.1 => ./b1
42 example.net/b v0.2.0 => ./b2
43)
44-- example.go --
45package example
46
47import _ "example.net/a"
48
49-- a10/go.mod --
50module example.net/a
51
52go 1.16
53-- a10/a.go --
54package a
55
56-- a11/go.mod --
57module example.net/a
58
59go 1.16
60
61require example.net/b v0.1.0
62-- a11/a.go --
63package a
64-- a11/unimported/unimported.go --
65package unimported
66
67import _ "example.net/b"
68
69
70-- a20/go.mod --
71module example.net/a
72
73go 1.16
74-- a20/a.go --
75package a
76
77-- b1/go.mod --
78module example.net/b
79
80go 1.16
81-- b1/b.go --
82package b
83
84-- b2/go.mod --
85module example.net/b
86
87go 1.16
88
89require example.net/a v0.2.0
90-- b2/b.go --
91package b
92-- b2/b_test.go --
93package b_test
94
95import _ "example.net/a"
View as plain text