Install Brew (skip if you already did)
ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
Update & Install Go
brew update&& brew install golang
Setup Workspace
It?s considered best practice to use $HOME/go location for your workspace, so let?s do that!
mkdir -p $HOME/go/{bin,src,pkg}
We created two important folders bin and src that?ll be used for GO
Setup Environment
We?ll need to add to .bashrc or .zshrc (if you?re using zsh) with the following info. (Ex: nano ~/.bashrc )
export GOPATH=$HOME/goexport GOROOT=”$(brew –prefix golang)/libexec”export PATH=”$PATH:${GOPATH}/bin:${GOROOT}/bin”
reload the settings with source $HOME/.bashrc (or .zshrc )
Feel free to start any project (make new folder) under ~/go/src and go from there.