Originate Guides - Go - Installation
brew install go
Download binary release then follow instructions: https://golang.org/dl/
Configuration for macOS and Linux
- create your Go workspace directory, for example
if your Go workspace is not in
~/go, set the environment variables
GOPATHto the Go workspace path
~/gois the default since Go 1.8, so if you use that path, you don't have to set it
- the environment variable
GOROOTseems not necessary when installing via HomeBrew
A possible solution to the problem of the Go workspace cluttering up with dependencies is to have two Go workspaces: one for code you are working on, and another one for dependencies.
If you pick
~/go-external for the latter, your GOPATH should look like
In this case,
go get fetches into the first workspace.
To work on code, manually clone it into the second workspace.
Go uses both workspaces simultaneously.
A downside is that certain tools might not work fully in this setup.
More info here
Official Installer guide