Where go get download file?

I’m wondering where the go get download and put the files when I set up GOPATH?

When using GO111MODULE=on, does go get still download the file or just cashe it based on go.mod file? new to cashe, so does these cashed file disappear when I shut down my machine?


1 Like

go get download and installed into GOBIN. If GOPATH is set and GOBIN is not, GOBIN automatically becomes GOPATH/bin.

go get module caches the module in GOPATH/pkg/mod. The cache is persistent so you won’t lose it when you shutdown the machine.

To know your current settings, simply use env like (I’m on Linux so this is mine):

$ go env

More read up: https://golang.org/cmd/go/#hdr-GOPATH_environment_variable.

1 Like

Just read through the docs again, yeah, we still need the GOBIN/GOPATH configuration. No new updates about getting rid GOPATH yet. :sleepy:

1 Like

No worries, OP has a different thread and is aware of the “Go Module vs. GOPATH” development and how to approach them.

As far as all the documentations, we still need to set GOPATH. Even the installation guide is still requiring new setup to set GOPATH (https://golang.org/doc/install#testing).


GOPATH and Modules
When using modules, GOPATH is no longer used for resolving imports. However, it is still used to store downloaded source code (in GOPATH/pkg/mod) and compiled commands (in GOPATH/bin).
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.