# -u=patch will patch dependencies as far as possible, but not so far that they
# conflict with other command-line arguments.

go list -m all
stdout '^example.net/a v0.1.0 '
stdout '^example.net/b v0.1.0 '

go get -d -u=patch example.net/a@v0.2.0
go list -m all
stdout '^example.net/a v0.2.0 '
stdout '^example.net/b v0.1.1 '  # not v0.1.2, which requires …/a v0.3.0.

-- go.mod --
module example

go 1.16

require (
	example.net/a v0.1.0
	example.net/b v0.1.0 // indirect
)

replace (
	example.net/a v0.1.0 => ./a
	example.net/a v0.2.0 => ./a
	example.net/a v0.3.0 => ./a
	example.net/b v0.1.0 => ./b10
	example.net/b v0.1.1 => ./b11
	example.net/b v0.1.2 => ./b12
)
-- example.go --
package example

import _ "example.net/a"

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

go 1.16

require example.net/b v0.1.0
-- a/a.go --
package a

import _ "example.net/b"

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

go 1.16

require example.net/a v0.1.0
-- b10/b.go --
package b
-- b10/b_test.go --
package b_test

import _ "example.net/a"

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

go 1.16

require example.net/a v0.2.0
-- b11/b.go --
package b
-- b11/b_test.go --
package b_test

import _ "example.net/a"

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

go 1.16

require example.net/a v0.3.0
-- b12/b.go --
package b
-- b12/b_test.go --
package b_test

import _ "example.net/a"
