February 10, 2020

Quick Setup Go on macOS

Go, also known as Golang, is a statically typed, compiled programming language designed at Google by Robert Griesemer, Rob Pike, and Ken Thompson. Go is syntactically similar to C, but with memory safety, garbage collection, structural typing, and CSP-style concurrency.

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

  1. Install go with homebrew
$ brew install go
  1. Setup go environment

Edit the bash profile file used, edit the ~/.bashrc file if you use bash default, and ~/.zshrc if you use zsh. Use your favorite text editor. I currently use zsh, and use vim as a text editor.

$ vi ~/.zshrc

Then add the following script. I will place the go working directory at ~/Git/GitHub/icarrr/Go.

export GOPATH=$HOME/Git/GitHub/icarrr/Go

Save and exit, then reload the bash profile.

$ source ~/.zshrc

Create go working directory.

$ mkdir -p $GOPATH/{src,bin,pkg}

At this point, go and its working directory are setup.