1 # -u=patch will patch dependencies as far as possible, but not so far that they
2 # conflict with other command-line arguments.
3
4 go list -m all
5 stdout '^example.net/a v0.1.0 '
6 stdout '^example.net/b v0.1.0 '
7
8 go get -u=patch example.net/a@v0.2.0
9 go list -m all
10 stdout '^example.net/a v0.2.0 '
11 stdout '^example.net/b v0.1.1 ' # not v0.1.2, which requires …/a v0.3.0.
12
13 -- go.mod --
14 module example
15
16 go 1.16
17
18 require (
19 example.net/a v0.1.0
20 example.net/b v0.1.0 // indirect
21 )
22
23 replace (
24 example.net/a v0.1.0 => ./a
25 example.net/a v0.2.0 => ./a
26 example.net/a v0.3.0 => ./a
27 example.net/b v0.1.0 => ./b10
28 example.net/b v0.1.1 => ./b11
29 example.net/b v0.1.2 => ./b12
30 )
31 -- example.go --
32 package example
33
34 import _ "example.net/a"
35
36 -- a/go.mod --
37 module example.net/a
38
39 go 1.16
40
41 require example.net/b v0.1.0
42 -- a/a.go --
43 package a
44
45 import _ "example.net/b"
46
47 -- b10/go.mod --
48 module example.net/b
49
50 go 1.16
51
52 require example.net/a v0.1.0
53 -- b10/b.go --
54 package b
55 -- b10/b_test.go --
56 package b_test
57
58 import _ "example.net/a"
59
60 -- b11/go.mod --
61 module example.net/b
62
63 go 1.16
64
65 require example.net/a v0.2.0
66 -- b11/b.go --
67 package b
68 -- b11/b_test.go --
69 package b_test
70
71 import _ "example.net/a"
72
73 -- b12/go.mod --
74 module example.net/b
75
76 go 1.16
77
78 require example.net/a v0.3.0
79 -- b12/b.go --
80 package b
81 -- b12/b_test.go --
82 package b_test
83
84 import _ "example.net/a"
85
View as plain text