You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a go.mod such as the following to be able to work with a forked repo:
go 1.16
require github.com/nats-io/nats.go v1.10.1-0.20210401234754-e0d6a6af9882
replace github.com/nats-io/nats.go => github.com/wallyqs/nats.go v1.11.50
when running go mod tidy it will fetch the dependencies of the upstream module (in require) instead of the ones of the module in replace. If go mod tidy is avoided though, just running go run -mod=mod app.go would correctly fetch the deps from the replaced repo.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Given a
go.mod
such as the following to be able to work with a forked repo:when running
go mod tidy
it will fetch the dependencies of the upstream module (inrequire
) instead of the ones of the module inreplace
. Ifgo mod tidy
is avoided though, just runninggo run -mod=mod app.go
would correctly fetch the deps from the replaced repo.What did you expect to see?
Expected to see the result including only dependencies related to the replaced module like this: https://github.com/wallyqs/nats-go-mod-test/blob/main/go.sum
What did you see instead?
The
go.mod
got changed to include the extra dependencies of the module/repo being replaced instead: https://github.com/wallyqs/nats-go-mod-test/blob/bad-go-mod-tidy/go.modhttps://github.com/wallyqs/nats-go-mod-test/blob/bad-go-mod-tidy/go.sum
Sample app where this can be verified: https://github.com/wallyqs/nats-go-mod-test
Original module: https://github.com/nats-io/nats.go/blob/master/go.mod
Module which should replace original: https://github.com/wallyqs/nats.go/blob/v1.11.50/go.mod
The text was updated successfully, but these errors were encountered: