I’m new to Go but have 40 years of programming experience and more than 20 languages.
I have been exploring Go using a small project so the workspace only has about 18 files in 9 packages.
I have only ever used the ‘go test’ command. Since I’m changing most packages, doing an install seems like a waste of time.
I have been using a PC with limited disk space as it is only used to explore new stuff and after a few days of working with Go I ran out of disk space.
The culprit was the go-build directory which was many MB in size, but unfortunately I didn’t record the actual size. A bit of searching found the ‘go clean -cache’ command.
After 3 days of playing around the cache was 21.8 MB with a 500KB log file.
After another clean, the cache reached 12.3 MB in one day, again with a 500 KB log file.
Most of the entries are unusable since they don’t match any package source.
I have been unable to find any info on how the cache is designed to work, but it appears that it just keeps on getting bigger until you manually clean it. At which point it removes all entries. I would expect it to keep the latest entry for a package.
Subjectively, I felt that the elapsed time for my test runs varied noticeably.
I found it was much easier to simply turn off the cache.
I recently installed Go1.11 and was somewhat disturbed to see that 1.12 will require the use of the cache.
I hope I am missing something about how you are meant to work with the cache, but having to manually clean it to keep the size to a reasonable limit is a bit of a problem.
Since a clean removes all cache entries it seems to defeat the purpose of a cache.