-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
proposal: cmd/go: allow disabling build cache trimming #69565
Comments
Related Issues and Documentation
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.) |
CC @matloob |
I don't know if this justifies its own environment variable (that would show up in |
@matloob If you mean something we can set via the |
Yes. That is what I mean. |
Proposal Details
We have our own docker image containing our Go toolchain. As an optimization, we also pre-compile the standard library (
go build std
) so that it is in the gocache.Evidently, the various Go tools will trim the cache upon exit. In particular, they will delete any files in the cache that have not been modified in the last five days. While this may be reasonable for a cache on someone's host machine, it does not make sense for a short-lived container using a cache from its image, since the mtimes will all reflect when the image was built. At best, it trimming the cache is pointless because the container will be destroyed shortly, and at worst is actively counterproductive as those cached files may be used by subsequent commands.
Please add an environment variable to disable trimming the gocache upon command exit. The specific name is immaterial, but something like
GOCACHE_AUTO_TRIM=0
would be fine.The text was updated successfully, but these errors were encountered: