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