1 # If 'go get -u' finds an upgrade candidate that isn't viable,
2 # but some other upgraded module's requirement moves past it
3 # (for example, to a higher prerelease), then we should accept
4 # the transitive upgrade instead of trying lower roots.
5
6 go get -v -u . example.net/b@v0.1.0
7 cmp go.mod go.mod.want
8
9 -- go.mod --
10 module example
11
12 go 1.17
13
14 require (
15 example.net/a v0.1.0
16 example.net/b v0.1.0
17 example.net/c v0.1.0
18 )
19
20 replace (
21 example.net/a v0.1.0 => ./a1
22 example.net/a v0.2.0-pre => ./a2p
23 example.net/b v0.1.0 => ./b
24 example.net/b v0.2.0 => ./b
25 example.net/c v0.1.0 => ./c1
26 example.net/c v0.2.0 => ./c2
27 )
28 -- go.mod.want --
29 module example
30
31 go 1.17
32
33 require (
34 example.net/a v0.2.0-pre
35 example.net/b v0.1.0
36 example.net/c v0.2.0
37 )
38
39 replace (
40 example.net/a v0.1.0 => ./a1
41 example.net/a v0.2.0-pre => ./a2p
42 example.net/b v0.1.0 => ./b
43 example.net/b v0.2.0 => ./b
44 example.net/c v0.1.0 => ./c1
45 example.net/c v0.2.0 => ./c2
46 )
47 -- example.go --
48 package example
49
50 import (
51 _ "example.net/a"
52 _ "example.net/b"
53 _ "example.net/c"
54 )
55 -- a1/go.mod --
56 module example.net/a
57
58 go 1.17
59
60 require example.net/b v0.2.0
61 -- a1/a.go --
62 package a
63
64 import _ "example.net/b"
65 -- a2p/go.mod --
66 module example.net/a
67
68 go 1.17
69 -- a2p/a.go --
70 package a
71 -- b/go.mod --
72 module example.net/b
73
74 go 1.17
75 -- b/b.go --
76 package b
77 -- c1/go.mod --
78 module example.net/c
79
80 go 1.17
81
82 require example.net/a v0.1.0
83 -- c1/c.go --
84 package c
85
86 import _ "example.net/a"
87 -- c2/go.mod --
88 module example.net/c
89
90 go 1.17
91
92 require example.net/a v0.2.0-pre
93 -- c2/c.go --
94 package c
95
96 import _ "example.net/c"
97
View as plain text