aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/mod_indirect.txt
blob: 87a3f0b10f741136499a64e1e0913e33d346364a (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
70
71
72
73
74
75
76
77
78
79
80
81
env GO111MODULE=on

# golang.org/issue/31248: module requirements imposed by dependency versions
# older than the selected version must still be taken into account.

env GOFLAGS=-mod=readonly

# Indirect dependencies required via older-than-selected versions must exist in
# the module graph, but do not need to be listed explicitly in the go.mod file
# (since they are implied).
go mod graph
stdout i@v0.1.0

# The modules must also appear in the build list, not just the graph.
go list -m all
stdout '^i v0.1.0'

# The packages provided by those dependencies must resolve.
go list all
stdout '^i$'

-- go.mod --
module main

go 1.13

require (
	a v0.0.0
	b v0.0.0
	c v0.0.0
)

// Apply replacements so that the test can be self-contained.
// (It's easier to see all of the modules here than to go
// rooting around in testdata/mod.)
replace (
	a => ./a
	b => ./b
	c => ./c
	x v0.1.0 => ./x1
	x v0.2.0 => ./x2
	i => ./i
)
-- main.go --
package main

import (
	_ "a"
	_ "b"
	_ "c"
)

func main() {}
-- a/go.mod --
module a
go 1.13
require x v0.1.0
-- a/a.go --
package a
-- b/go.mod --
module b
go 1.13
require x v0.2.0
-- b/b.go --
package b
-- c/go.mod --
module c
go 1.13
-- c/c.go --
package c
import _ "i"
-- x1/go.mod --
module x
go1.13
require i v0.1.0
-- x2/go.mod --
module x
go1.13
-- i/go.mod --
-- i/i.go --
package i