Skip to content
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/internal/modload: clean up checksum-saving logic #60748

Open
bcmills opened this issue Jun 12, 2023 · 0 comments
Open

cmd/go/internal/modload: clean up checksum-saving logic #60748

bcmills opened this issue Jun 12, 2023 · 0 comments
Labels
GoCommand cmd/go modules NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Jun 12, 2023

In CL 502015, I noticed a longstanding problem with the way cmd/go determines which checksums need to be saved in the go.sum file. Namely, the keepSums helper function assumes that a module's checksum is needed if:

  1. the module's checksum was consulted in the course of executing the command, and
  2. the module is the selected version of its path in the module graph.

That may have been true originally, but it's a very fragile assumption especially given module graph pruning and lazy module loading. In particular, commands like go get and go list -u -m all may download module contents or go.mod files in order to compute their output, even when those inputs are not otherwise relevant and do not result in any persistent changes to the module's requirements.

For now, we allow those extra checksums to be recorded and rely on go mod tidy to clean them up again later, but it would be better still not to record the irrelevant checksums in the first place. To do that, we probably need to make go get and go mod download more explicit about which modules they want to save, and make everything else less aggressive about saving checksums for modules in the build list.

See previously:

@bcmills bcmills added NeedsFix The path to resolution is known, but the work has not been done. GoCommand cmd/go modules labels Jun 12, 2023
@bcmills bcmills added this to the Backlog milestone Jun 12, 2023
@bcmills bcmills changed the title cmd/go/internal/modload: clean up checksum-saving cmd/go/internal/modload: clean up checksum-saving logic Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go modules NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

1 participant