Setup a Linux Machine for Go Development

According to the Go Developer Survey 64% of Go Programmers use Linux.
Here is how I setup my Galago Pro for developing in Go on POP!_OS.

Basics (Power Management, Internet Browser, Terminal Emulator)

Tlp

$ sudo apt install tlp tlp-rdw
$ sudo tlp start (or starts automatically after reboot)

Chromium

$ sudo apt install chromium-browser

Tilix

$ sudo add-apt-repository ppa:webupd8team/terminix
$ sudo apt update
$ sudo apt install tilix

Version Control (Git)

$ sudo add-apt-repository ppa:git-core/ppa
$ sudo apt update
$ sudo apt install git

$ sudo apt install gitk
$ sudo apt install kdiff3

$ git config –global –add merge.tool kdiff3
$ git config –global –add diff.guitool kdiff3
$ git config –global user.name “YOUR NAME”
$ git config –global user.email your_email@address.com

After Git is installed and setup, then configure SSH for Github.

Install Go

Download the latest version of Go (currently 1.10) to your Downloads folder. From the Downloads folder, extract Go into /usr/local

$ tar -C /usr/local -xzf go1.10.linux-amd64.tar.gz

Add Go to your path (add to bottom of .bashrc file)

export PATH=$PATH:/usr/local/go/bin

Verify Go version

$ go version

Setup Go Workspace

Go assumes a working folder of $HOME/go with folders bin, pkg and src folders e.g.

  • go/
    • bin/
    • pkg/
    • src/

If you’d like to use a different location e.g. I use $HOME/Projects/Go, then you need to set the GOPATH environment variable (add to bottom of .bashrc file).

export GOPATH=$HOME/Projects/Go

Read the Testing your installation documentation for more info.

Tooling for Development

VSCode
Downlod the .deb file to your Downloads folder. From the Downloads folder, install VSCode

$ sudo apt install code_1.XXX.deb

Go for VSCode
From the extensions tab in VSCode, search for ‘Go’ and click install.
Add Setting for GoPath, to ensure VSCode correctly locates GOPATH.

go.inferGopath: true

From the Command Palette, run Go: Install/Update Tools

You’re ready to Go 🙂