Install Go
In order to install Go framework follow these instructions:
Linux
Debian/Ubuntu
$ apt-get install go
Redhat/CentOS/Fedora
$ yum install go
Mac OS
- Install Go using brew
$ brew install go
- You might see following logs as bellow:
Updating Homebrew... xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun ==> Auto-updated Homebrew! Updated 3 taps (homebrew/cask-versions, homebrew/core and homebrew/cask). ==> New Formulae azure-storage-cpp fluxctl gitmoji healpix maven@3.5 mesa ==> Updated Formulae maven ✔ elasticsearch libfabric q node ✔ emscripten libgit2 qcli ruby ✔ erlang@20 libgit2-glib .... .... .... docker-ls libbitcoin-protocol pulumi youtube-dl doitlive libbitcoin-server py2cairo dub libdill py3cairo duc liberasurecode python ==> Deleted Formulae kibana@4.4 maven@3.0 maven@3.1 nethack4 ==> Downloading https://homebrew.bintray.com/bottles/go-1.11.2.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Pouring go-1.11.2.mojave.bottle.tar.gz ==> Caveats A valid GOPATH is required to use the `go get` command. If $GOPATH is not specified, $HOME/go will be used by default: https://golang.org/doc/code.html#GOPATH You may wish to add the GOROOT-based install location to your PATH: export PATH=$PATH:/usr/local/opt/go/libexec/bin ==> Summary ? /usr/local/Cellar/go/1.11.2: 9,282 files, 404MB
- If you see following error:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
- that means you have not installed Xcode Development Command Line Tools which you can install it using following command:
$ xcode-select --install
Setup Go Workstation
- You will see following prompt, click Install button:
$ vi ~/.bash_profile
- if you might have installed zhs and ohmyzhs ~/.zshrc
$ vi ~/.zshrc
- Setup your paths, you can have these exports in your user home .bash_profile file and add following content into
export GOPATH=$HOME/go export GOBIN=$GOPATH/bin export PATH=$PATH:$GOBIN
- Run following source command to reload your .bash_profile or .zshrc.
$ source ~/.bash_profile
- Make sure you create go/src folders in your home folder
$ mkdir -p ~/go/bin $ mkdir -p ~/go/src $ mkdir -p ~/go/pkg
Microsoft Windows
Refer to https://golang.org/doc/install#windows for windows installation