aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/mod_get_extra.txt
blob: 7efa24e87b0d3522d18a14b1c760ca6df88649c5 (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
cp go.mod go.mod.orig

# The -u flag should not (even temporarily) upgrade modules whose versions are
# determined by explicit queries to any version other than the explicit one.
# Otherwise, 'go get -u' could introduce spurious dependencies.

go get -d -u example.net/a@v0.1.0 example.net/b@v0.1.0
go list -m all
stdout '^example.net/a v0.1.0 '
stdout '^example.net/b v0.1.0 '
! stdout '^example.net/c '


# TODO(bcmills): This property does not yet hold for modules added for
# missing packages when the newly-added module matches a wildcard.

cp go.mod.orig go.mod

go get -d -u example.net/a@v0.1.0 example.net/b/...@v0.1.0
go list -m all
stdout '^example.net/a v0.1.0 '
stdout '^example.net/b v0.1.0 '
stdout '^example.net/c '  # BUG, but a minor and rare one


-- go.mod --
module example

go 1.15

replace (
	example.net/a v0.1.0 => ./a1
	example.net/b v0.1.0 => ./b1
	example.net/b v0.2.0 => ./b2
	example.net/c v0.1.0 => ./c1
	example.net/c v0.2.0 => ./c1
)

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

go 1.15

// example.net/a needs a dependency on example.net/b, but lacks a requirement
// on it (perhaps due to a missed file in a VCS commit).
-- a1/a.go --
package a
import _ "example.net/b"

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

go 1.15
-- b1/b.go --
package b

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

go 1.15

require example.net/c v0.1.0
-- b2/b.go --
package b

-- c1/go.mod --
module example.net/c

go 1.15