Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why does `go mod` take up space on another disk than my GOPATH?

I’m trying to build a completely new project in order to run some unit tests. I’m using Windows + WSL.

When I try to run the tests, obviously first it takes the go.mod file and starts downloading all the packages.

Though, while my GOPATH is set on my D disk, the free space on my C disk is visibly running lower and lower. I don’t understand what other process (supposedly part of building the project) can take up space on my C disk while building the project.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I also want to move everything to not depend on my C disk, as I don’t have much more space left, but other than moving the GOPATH (which obviously isn’t the solution here) I don’t understand what I can do.

I tried building the project, the dependencies started downloading (via an automatic go mod on the go.mod file deps) and I expected them to download on the GOPATH/src, which is on disk D (verified through a number of different ways) on Windows on my machine, but it actually takes space on C.

>Solution :

GOCACHE is set to a directory on the C drive.

Fix by running go clean -cache and then set the GOCACHE environment variable to a directory on the D drive.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading