This function (moved to its current location in https://go.dev/cl/682717) is required to clean up the module cache because Sandbox.RunGoCommand doesn't honor the GOMODCACHE environment variable provided by settings.env; in fact it explicitly clears it.
The task of this issue is to honor that variable, and eliminate the need for CleanModCache (see also the other hacks in the tests of the above CL related to the same problem), or to document more clearly why this is impossible.
Comment From: gabyhelp
Related Issues
- cmd/go: go clean should not accept flags like -modcache with packages #53725 (closed)
- x/tools: use GOMODCACHE where appropriate #39761 (closed)
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)