In this blog post, you can find answers to

  • how to instal git in linux/mac
  • how to configure git global settings in linux/mac
  • how to install mercurial in linux/mac
  • how to install homebrew
  • how to install golang in linux/mac
  • how to set PATH in linux/mac
  • how to format go code on save in linux/mac
  • how to install goimports in linux/mac
  • how to install GoSublime in linux/mac
  • how to configure GoSublime in linux/mac

To be able to use go get properly, we need git and mercurial

####Git installation

Install Git

$ sudo apt-get install git

$ brew install git

if you dont have brew, get it

ruby -e "$(curl -fsSL"

Set global config (if you need to)

$ git config --global "Name Surname"
$ git config --global "[email protected]"

####Mercurial Installation

Install Mercurial

$ sudo apt-get install mercurial

$ brew install mercurial

Install Go

Get go, this will install go to your /usr/local/go/ folder

$ curl -s | sudo tar -v -C /usr/local -xz

Or you can use other packages from

Set your path in .bashrc

export GOPATH="/<projectroot>/go"  
export GOROOT="/usr/local/go"  

Install goimports, vet - This is realy useful for if you dont want to write your missing import paths, and formatting your code vet checks your code and warns about the Go style

$ go get
$ go build
$ go install

goimports fixes import paths and formats code

$ go get
$ go build
$ go install
$ mv vet $GOROOT
$ mv goimports $GOROOT

####Sublime Installation

  • Install Sublime link

  • Install Sublime Package Control link

  • Open Sublime Command Palette (Super+Shift+P).

  • Type Package Control: Install Package

  • Install GoSublime package from package control

  • Sample GoSublime Settings link (Preferences > Package Settings > GoSublime)