-
Notifications
You must be signed in to change notification settings - Fork 17.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go: mod tidy removes replaced go.sum entries #31190
Labels
Comments
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
I have a repository with two submodules, a library module and a main module depending on the library module. For convenience when working on both modules at the same time, I want to use a replace directive to point to the local path of the library. It's described in https://github.com/golang/go/wiki/Modules:
I plan to check in the replace directive to the project repository, because it will be ignored by external modules importing main.
However, running
go mod tidy
when the main module contains a replace directive, the go.sum entries disappear:What did you expect to see?
The go.sum lines were kept for the lib module.
What did you see instead?
go mod tidy
removes the replaced module's go.sum lines. The lines are technically not used, but will be when the main is not the main module, e.g. someone importsgithub.com/eliasnaur/gomodtidy/main
.The text was updated successfully, but these errors were encountered: