Go build touches ~/.cache which is undesirable.
How can I change the location of this directory?
From the official documentation:
Build and test caching
The go command caches build outputs for reuse in future builds. The default location for cache data is a subdirectory named go-build in the standard user cache directory for the current operating system. Setting the GOCACHE environment variable overrides this default, and running 'go env GOCACHE' prints the current cache directory.
Note that the aforementioned go env GOCACHE
command can be used to make sure
that GOCACHE
points to a desirable location before e.g.: building with
go build
. Example:
$ go env GOCACHE
/home/user/.cache/go-build
$ GOCACHE=/foo/bar
$ export GOCACHE
$ go env GOCACHE
/foo/bar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With