| # This test covers a crazy edge-case involving wildcards and multiple passes of |
| # patch-upgrades, but if we get it right we probably get many other edge-cases |
| # right too. |
| |
| go list -m all |
| stdout '^example.net/a v0.1.0 ' |
| ! stdout '^example.net/b ' |
| |
| |
| # Requesting pattern example.../b by itself fails: there is no such module |
| # already in the build list, and the wildcard in the first element prevents us |
| # from attempting to resolve a new module whose path is a prefix of the pattern. |
| |
| ! go get -d -u=patch example.../b@upgrade |
| stderr '^go get: no modules to query for example\.\.\./b@upgrade because first path element contains a wildcard$' |
| |
| |
| # Patching . causes a patch to example.net/a, which introduces a new match |
| # for example.net/b/..., which is itself patched and causes another upgrade to |
| # example.net/a, which is then patched again. |
| |
| go get -d -u=patch . example.../b@upgrade |
| go list -m all |
| stdout '^example.net/a v0.2.1 ' # upgraded by dependency of b and -u=patch |
| stdout '^example.net/b v0.2.0 ' # introduced by patch of a and upgraded by wildcard |
| |
| |
| -- go.mod -- |
| module example |
| |
| go 1.16 |
| |
| require example.net/a v0.1.0 |
| |
| replace ( |
| example.net/a v0.1.0 => ./a10 |
| example.net/a v0.1.1 => ./a11 |
| example.net/a v0.2.0 => ./a20 |
| example.net/a v0.2.1 => ./a20 |
| example.net/b v0.1.0 => ./b1 |
| example.net/b v0.1.1 => ./b1 |
| example.net/b v0.2.0 => ./b2 |
| ) |
| -- example.go -- |
| package example |
| |
| import _ "example.net/a" |
| |
| -- a10/go.mod -- |
| module example.net/a |
| |
| go 1.16 |
| -- a10/a.go -- |
| package a |
| |
| -- a11/go.mod -- |
| module example.net/a |
| |
| go 1.16 |
| |
| require example.net/b v0.1.0 |
| -- a11/a.go -- |
| package a |
| -- a11/unimported/unimported.go -- |
| package unimported |
| |
| import _ "example.net/b" |
| |
| |
| -- a20/go.mod -- |
| module example.net/a |
| |
| go 1.16 |
| -- a20/a.go -- |
| package a |
| |
| -- b1/go.mod -- |
| module example.net/b |
| |
| go 1.16 |
| -- b1/b.go -- |
| package b |
| |
| -- b2/go.mod -- |
| module example.net/b |
| |
| go 1.16 |
| |
| require example.net/a v0.2.0 |
| -- b2/b.go -- |
| package b |
| -- b2/b_test.go -- |
| package b_test |
| |
| import _ "example.net/a" |