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

WBOY
Release: 2024-02-05 23:12:04
forward
1113 people have browsed it

为什么 `go mod` 占用了另一个磁盘上的空间而不是我的 GOPATH?

Question content

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.


Correct answer


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!

source:stackoverflow.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!