Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/go: should we reuse GOMODCACHE in TestScript? #42017
When a txt script file is run as a subtest, we share the host's GOCACHE by default, presumably to allow reusing the build cache and speeding up
You can verify this easily:
Should we do the same with the new GOMODCACHE Go environment variable? That would let the tests share the host's module download cache.
The upside is that, for most tests, we would download and copy fewer files, even if it's just the ones in
A potential downside is that if a test relies on actual downloads happening, they'd have to unset GOMODCACHE to use an empty module download cache.
It would be possible, perhaps, to use a separate
I don't think there would be much benefit to doing this. Tests that run in
There are a number of tests that verify whether something is present in the module cache. If we used the host's module cache, those tests would need to be updated to set
Another issue is that we sometimes change the content of modules in the test proxy. We run a test checksum database that keeps up with those changes, but we wouldn't automatically re-fetch a file in the module cache that's out of date.