Open
Description
The GOCACHE appears to lack a disk size limit - this is a problem in a space constrained environment and/or when running go on a disk that is nearing capacity. For example, on the openbsd/arm builder (which runs on a USB stick), the ~/.cache/go-build
directory runs past several GB in a very short time, which then leads to various failures (git clone
or go builds). The only option that I currently appear to have is to run go cache -clean
regularly, in order to keep the cache at a respectable size. It seems that having a configurable upper bound would be preferable and/or free disk space based checks that prevent writes (e.g. evict then write) to the cache from failing when the disk is full due, partly due to a large GOCACHE:
[gopher@cubox ~ 102]$ du -csh ~/.cache/go-build
2.2G /home/gopher/.cache/go-build
2.2G total
[gopher@cubox ~ 103]$ df -h /home
Filesystem Size Used Avail Capacity Mounted on
/dev/sd1m 9.0G 8.5G -6.0K 100% /home
[gopher@cubox ~ 104]$ go build -o /tmp/main /tmp/main.go
/home: write failed, file system is full
/home: write failed, file system is full
/home: write failed, file system is full
/home: write failed, file system is full
/home: write failed, file system is full
/home: write failed, file system is full
/home: write failed, file system is full
/home: write failed, file system is full
/home: write failed, file system is full
[gopher@cubox ~ 105]$ du -csh ~/.cache/go-build
2.2G /home/gopher/.cache/go-build
2.2G total
[gopher@cubox ~ 106]$ df -h /home
Filesystem Size Used Avail Capacity Mounted on
/dev/sd1m 9.0G 8.5G -6.0K 100% /home