| 1 |
env GO111MODULE=on |
| 2 |
|
| 3 |
# golang.org/issue/31248: required modules imposed by dependency versions |
| 4 |
# older than the selected version must still be taken into account. |
| 5 |
|
| 6 |
env GOFLAGS=-mod=readonly |
| 7 |
|
| 8 |
# Indirect dependencies required via older-than-selected versions must exist in |
| 9 |
# the module graph, but do not need to be listed explicitly in the go.mod file |
| 10 |
# (since they are implied). |
| 11 |
go mod graph |
| 12 |
stdout [email protected] |
| 13 |
|
| 14 |
# The modules must also appear in the build list, not just the graph. |
| 15 |
go list -m all |
| 16 |
stdout '^i v0.1.0' |
| 17 |
|
| 18 |
# The packages provided by those dependencies must resolve. |
| 19 |
go list all |
| 20 |
stdout '^i$' |
| 21 |
|
| 22 |
-- go.mod -- |
| 23 |
module main |
| 24 |
|
| 25 |
go 1.13 |
| 26 |
|
| 27 |
require ( |
| 28 |
a v0.0.0 |
| 29 |
b v0.0.0 |
| 30 |
c v0.0.0 |
| 31 |
) |
| 32 |
|
| 33 |
// Apply replacements so that the test can be self-contained. |
| 34 |
// (It's easier to see all of the modules here than to go |
| 35 |
// rooting around in testdata/mod.) |
| 36 |
replace ( |
| 37 |
a => ./a |
| 38 |
b => ./b |
| 39 |
c => ./c |
| 40 |
x v0.1.0 => ./x1 |
| 41 |
x v0.2.0 => ./x2 |
| 42 |
i => ./i |
| 43 |
) |
| 44 |
-- main.go -- |
| 45 |
package main |
| 46 |
|
| 47 |
import ( |
| 48 |
_ "a" |
| 49 |
_ "b" |
| 50 |
_ "c" |
| 51 |
) |
| 52 |
|
| 53 |
func main() {} |
| 54 |
-- a/go.mod -- |
| 55 |
module a |
| 56 |
go 1.13 |
| 57 |
require x v0.1.0 |
| 58 |
-- a/a.go -- |
| 59 |
package a |
| 60 |
-- b/go.mod -- |
| 61 |
module b |
| 62 |
go 1.13 |
| 63 |
require x v0.2.0 |
| 64 |
-- b/b.go -- |
| 65 |
package b |
| 66 |
-- c/go.mod -- |
| 67 |
module c |
| 68 |
go 1.13 |
| 69 |
-- c/c.go -- |
| 70 |
package c |
| 71 |
import _ "i" |
| 72 |
-- x1/go.mod -- |
| 73 |
module x |
| 74 |
go1.13 |
| 75 |
require i v0.1.0 |
| 76 |
-- x2/go.mod -- |
| 77 |
module x |
| 78 |
go1.13 |
| 79 |
-- i/go.mod -- |
| 80 |
-- i/i.go -- |
| 81 |
package i |