Before You Come to Class

The following is a set of tasks that can be done prior to showing up for class. We will also do this in class if anyone has not completed it. However, the more attendees that complete this ahead of time the more time we have to cover additional training material.

Joining the Go Slack Community

We use a slack channel to share links, code, and examples during the training. This is free. This is also the same slack community you will use after training to ask for help and interact with may Go experts around the world in the community.

  1. Using the following link, fill out your name and email address:
  2. Check your email, and follow the link to the slack application.
  3. Join the training channel by clicking on this link:
  4. Click the “Join Channel” button at the bottom of the screen.

Installing Go

Preferred Method (Windows, Mac, Linux)

Download the latest installer from go:

Mac - Using Home Brew

It's preferred that you download and install the package. However, if you are a homebrew user, you can use the following commands:
$ brew update
$ brew install go

Linux - Using APT

$ sudo apt-get update
$ sudo apt-get install golang
Note: This can leave you with an old version of go as they don't update the package manager as timely as they should

Environment - $GOPATH

The GOPATH environment variable specifies the location of your workspace. It is likely the only environment variable you'll need to set when developing Go code.

To get started, create a workspace directory and set GOPATH accordingly. Your workspace can be located wherever you like, but we'll use $HOME/go in this document. Note that this must not be the same path as your Go installation.

NOTE: This is only necessary if the method of installation used above did NOT do this.

Instructions for Linux or Mac

$ mkdir $HOME/go
$ export GOPATH=$HOME/go

Instructions for Windows

From a command prompt:

$ mkdir "%USERPROFILE%\go"

  1. Go to the Control Panel > System > Advanced Tab > Environment Variables.
  2. Add a new User Variable (not a system variable)

Variable name: GOPATH
Variable value: %USERPROFILE%\go

NOTE: It's very likely you will need to reboot for this variable to take effect.

Add Go Bin directory to $PATH

For convenience, add the workspace's bin subdirectory to your PATH:

NOTE: If you used an installer, you typically do not need to do this step.

Instructions for Linux or Mac

export PATH=$PATH:$GOPATH/bin

Instructions for Windows

  1. Go to the Control Panel > System > Advanced Tab > Environment Variables.
  2. Under System variables, select "Path" from the box, and click "edit". Add ;C:\Go\bin to the value and click ok.

Test your installation

Check that Go is installed correctly by building a simple program, as follows.

Create a file named sys_check.go, inside of $GOPATH/src and put the following program in it:

package main

import (

func main() {
	gopath := os.Getenv("GOPATH")
	if gopath == "" {
		log.Fatal("Your GOPATH has not been set!")

	path := os.Getenv("PATH")
	gobin := filepath.Join(gopath, "bin")
	if !strings.Contains(path, gobin) {
		log.Fatalf("Your PATH does not contain %s", gobin)


From inside of your $GOPATH/src folder run the program as follows:

$ go run sys_check.go

If you see the

message then your Go installation is working.

Revision Control Systems

Go has the ability to import remote packages via revision control systems with the `go get` command. To ensure that you can retrieve any remote package, be sure to install the following rcs software to your system.


Install Git

Mercurial (optional step)

Install Mercurial

Subversion (optional step)

Install Subversion

Bazaar (optional step)

Install Bazaar


Starter Material

While there is no requirement to do any pre-reading prior to class, the following articles provide great context for what you are about to learn.