# When adding a requirement, 'go get' prints a message for the requirement
# and for changed explicit dependencies. 'go get' does not print messages
# for changed indirect dependencies.
go list -m all
! stdout golang.org/x/text
go get rsc.io/quote@v1.5.2
stderr '^go: added rsc.io/quote v1.5.2$'
stderr '^go: upgraded rsc.io/sampler v1.0.0 => v1.3.0$'
! stderr '^go get.*golang.org/x/text'
go list -m all
stdout golang.org/x/text
cmp go.mod go.mod.upgrade

# When removing a requirement, 'go get' prints a message for the requiremnent
# and for changed explicit dependencies. 'go get' does not print messages
# for changed indirect dependencies.
go get rsc.io/sampler@none
stderr '^go: downgraded rsc.io/quote v1.5.2 => v1.3.0$'
stderr '^go: removed rsc.io/sampler v1.3.0$'
! stderr '^go get.*golang.org/x/text'
cmp go.mod go.mod.downgrade

# When removing or downgrading a requirement, 'go get' also prints a message
# for explicit dependencies removed as a consequence.
cp go.mod.usequote go.mod
go get rsc.io/quote@v1.5.1
stderr '^go: downgraded rsc.io/quote v1.5.2 => v1.5.1$'
stderr '^go: removed usequote v0.0.0$'

-- go.mod --
module m

go 1.16

require rsc.io/sampler v1.0.0
-- go.sum --
rsc.io/sampler v1.0.0 h1:SRJnjyQ07sAtq6G4RcfJEmz8JxqLyj3PoGXG2VhbDWo=
rsc.io/sampler v1.0.0/go.mod h1:cqxpM3ZVz9VtirqxZPmrWzkQ+UkiNiGtkrN+B+i8kx8=
-- go.mod.upgrade --
module m

go 1.16

require (
	rsc.io/quote v1.5.2 // indirect
	rsc.io/sampler v1.3.0
)
-- go.mod.downgrade --
module m

go 1.16

require (
	golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c // indirect
	rsc.io/quote v1.3.0 // indirect
)
-- go.mod.usequote --
module m

go 1.16

require usequote v0.0.0

replace usequote => ./usequote
-- usequote/go.mod --
module usequote

go 1.16

require rsc.io/quote v1.5.2
