1 # Regression test for https://golang.org/issue/48511:
2 # requirement minimization was accidentally replacing previous
3 # versions of the main module, causing dependencies to be
4 # spuriously dropping during requirement minimization and
5 # leading to an infinite loop.
6
7 cp go.mod go.mod.orig
8 go mod tidy
9 cmp go.mod go.mod.orig
10
11 go get -u=patch ./...
12 cmp go.mod go.mod.want
13
14 -- go.mod --
15 module example.net/m
16
17 go 1.16
18
19 replace (
20 example.net/a v0.1.0 => ./a
21 example.net/b v0.1.0 => ./b
22 example.net/b v0.1.1 => ./b
23 example.net/m v0.1.0 => ./m1
24 )
25
26 require example.net/a v0.1.0
27 -- go.mod.want --
28 module example.net/m
29
30 go 1.16
31
32 replace (
33 example.net/a v0.1.0 => ./a
34 example.net/b v0.1.0 => ./b
35 example.net/b v0.1.1 => ./b
36 example.net/m v0.1.0 => ./m1
37 )
38
39 require (
40 example.net/a v0.1.0
41 example.net/b v0.1.1 // indirect
42 )
43 -- m.go --
44 package m
45
46 import "example.net/a"
47 -- m1/go.mod --
48 module example.net/m
49
50 go 1.16
51
52 require example.net/b v0.1.0
53 -- a/go.mod --
54 module example.net/a
55
56 go 1.16
57
58 require example.net/m v0.1.0
59 -- a/a.go --
60 package a
61
62 import "example.net/b"
63 -- b/go.mod --
64 module example.net/b
65
66 go 1.16
67 -- b/b.go --
68 package b
69
View as plain text