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/test: files opened in tests should be cached by its content hash instead of mtime #71333

Closed
slsyy opened this issue Jan 20, 2025 · 2 comments
Labels
ToolProposal Issues describing a requested change to a Go tool or command-line program.

Comments

@slsyy
Copy link

slsyy commented Jan 20, 2025

https://github.com/golang/go/blob/40b3c0e58a0ae8dec4684a009bf3806769e0fc41/src/cmd/go/internal/test/test.go#L2013C1-L2026C3

This logic makes caching inefficient in non-local environments. For example in CI it is quite common to run a job in a separate local repositories, where mtimes are different, because that is how the git works

I propose to switch a hashing method to use files content or make it configurable in some way. The issue will be more visible when https://pkg.go.dev/cmd/go/internal/cacheprog@master becames popular as most of tests, which are loading files (for example stuff from testdata/*) won't be cached at all

@gabyhelp gabyhelp added the ToolProposal Issues describing a requested change to a Go tool or command-line program. label Jan 20, 2025
@slsyy
Copy link
Author

slsyy commented Jan 20, 2025

Thanks @gabyhelp, duplicate of #58571

@slsyy slsyy closed this as completed Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ToolProposal Issues describing a requested change to a Go tool or command-line program.
Projects
None yet
Development

No branches or pull requests

2 participants