I'm trying to build a brand new project to run some unit tests. I'm using Windows WSL.
When I try to run the test, obviously first it gets the go.mod file and starts downloading all the packages.
Even though my GOPATH is set on the D drive, the free space on my C drive is obviously getting less and less. I don't understand what other processes (which are supposed to be part of building the project) are taking up space on my C drive.
I also want to move everything to not be tied to my C drive since I don't have much space left, but other than moving the GOPATH (which is obviously not the solution here) I don't understand what I can do .
I try to build the project, the dependencies start downloading (via automatic go mod on the go.mod file deps) and I want them to download to GOPATH/src on the D drive (verified via multiple different ways) in I have Windows on my machine, but it actually takes up space on C.
GOCACHESet to the C drive directory p>
Fix by running go clean -cache
and then setting the GOCACHE environment variable to a directory on the D drive.
The above is the detailed content of Why does `go mod` take up space on another disk instead of my GOPATH?. For more information, please follow other related articles on the PHP Chinese website!