| env GO111MODULE=on |
| |
| # golang.org/issue/31248: required modules 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 |