aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/mod_get_wild.txt
blob: b88f268a1df60d37f0e68c0d8575a8822cc47600 (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
83
84
85
86
87
88
89
90
91
92
93
94
95
# This test covers a crazy edge-case involving wildcards and multiple passes of
# patch-upgrades, but if we get it right we probably get many other edge-cases
# right too.

go list -m all
stdout '^example.net/a v0.1.0 '
! stdout '^example.net/b '


# Requesting pattern example.../b by itself fails: there is no such module
# already in the build list, and the wildcard in the first element prevents us
# from attempting to resolve a new module whose path is a prefix of the pattern.

! go get -d -u=patch example.../b@upgrade
stderr '^go: no modules to query for example\.\.\./b@upgrade because first path element contains a wildcard$'


# Patching . causes a patch to example.net/a, which introduces a new match
# for example.net/b/..., which is itself patched and causes another upgrade to
# example.net/a, which is then patched again.

go get -d -u=patch . example.../b@upgrade
go list -m all
stdout '^example.net/a v0.2.1 '  # upgraded by dependency of b and -u=patch
stdout '^example.net/b v0.2.0 '  # introduced by patch of a and upgraded by wildcard


-- go.mod --
module example

go 1.16

require example.net/a v0.1.0

replace (
	example.net/a v0.1.0 => ./a10
	example.net/a v0.1.1 => ./a11
	example.net/a v0.2.0 => ./a20
	example.net/a v0.2.1 => ./a20
	example.net/b v0.1.0 => ./b1
	example.net/b v0.1.1 => ./b1
	example.net/b v0.2.0 => ./b2
)
-- example.go --
package example

import _ "example.net/a"

-- a10/go.mod --
module example.net/a

go 1.16
-- a10/a.go --
package a

-- a11/go.mod --
module example.net/a

go 1.16

require example.net/b v0.1.0
-- a11/a.go --
package a
-- a11/unimported/unimported.go --
package unimported

import _ "example.net/b"


-- a20/go.mod --
module example.net/a

go 1.16
-- a20/a.go --
package a

-- b1/go.mod --
module example.net/b

go 1.16
-- b1/b.go --
package b

-- b2/go.mod --
module example.net/b

go 1.16

require example.net/a v0.2.0
-- b2/b.go --
package b
-- b2/b_test.go --
package b_test

import _ "example.net/a"