One minute
GOPATH and GOROOT Setup With Brew Go Installation
Since Brew installs Go in another path this might be a bit confusing when setting up our environment with GOPATH and GOROOT.
But Brew sets some symbolic links that we can use, so I ended up having the following configuration into my .zshrc
. Would be the same in case you don’t use ZSH but in profile
file or .bashrc
file.
# Golang
export GOPATH=$HOME/go
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin