COS418 Assignment Setup

Go Installation

You will need a working Go environment for the assignments. Your version should be at least Go 1.5. The version that the Dropbox and Grading scripts will use is Go 1.6. The latest version as of the Fall 2016 semester is Go 1.7.

Cycles (Pre-installed)

The CS servers (cycles.cs.princeton.edu) are one option, if you have a CS account.

spin:~$ which go
/usr/bin/go
@spin:~$ go version
go version go1.6.3 linux/amd64
We have tested that all the infrastructure for the course works on these machines.

Manual for Various OSes

Another option is to install Go on your own machine manually. There are instructions to install from source or with a package installer for several operating systems at Google's Go site: golang.org.

Via Package Manager for OS X

Finally, for Macs many people use package management software, the two most common of which are Homebrew and MacPorts (these links include installation instructions for the package managers themselves). Here is a walkthrough of installing Go using each of these:

dustpuppy:~$ brew --version
0.9.5
dustpuppy:~$ go
-bash: go: command not found
dustpuppy:~$ brew install go
==> Downloading https://homebrew.bintray.com/bottles/go-1.7.1.el_capitan.bottle.
######################################################################## 100.0%
==> Pouring go-1.7.1.el_capitan.bottle.tar.gz
==> Caveats
As of go 1.2, a valid GOPATH is required to use the `go get` command:
  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.7.1: 6,436 files, 250.6M
dustpuppy:~$ go version
go version go1.7.1 darwin/amd64
NB: if brew install go attempts to install an ancient version (e.g. 1.3) you will have to do brew update first to refresh your list of packages that Homebrew knows about.
dustpuppy:~$ port version
Version: 2.3.4
dustpuppy:~$ go
-bash: go: command not found
dustpuppy:~$ sudo port install go
Password:
Warning: The Xcode Command Line Tools don't appear to be installed; most ports will likely fail to build.
Warning: Install them by running `xcode-select --install'.
--->  Computing dependencies for go
--->  Dependencies to be installed: go-1.4
--->  Fetching archive for go-1.4
--->  Attempting to fetch go-1.4-1.4.3_0.darwin_15.x86_64.tbz2 from https://packages.macports.org/go-1.4
--->  Attempting to fetch go-1.4-1.4.3_0.darwin_15.x86_64.tbz2.rmd160 from https://packages.macports.org/go-1.4
--->  Installing go-1.4 @1.4.3_0
--->  Activating go-1.4 @1.4.3_0
--->  Cleaning go-1.4
--->  Fetching archive for go
--->  Attempting to fetch go-1.7_0.darwin_15.x86_64.tbz2 from https://packages.macports.org/go
--->  Attempting to fetch go-1.7_0.darwin_15.x86_64.tbz2.rmd160 from https://packages.macports.org/go
--->  Installing go @1.7_0
--->  Activating go @1.7_0
--->  Cleaning go
--->  Updating database of binaries
--->  Scanning binaries for linking errors               
--->  No broken files found.
dustpuppy:~$ go version
go version go1.7 darwin/amd64

Tools

There are many commonly used tools in the Go ecosystem. The three most useful starting out are: Go fmt and Go vet, which are built-ins, and Golint, which is similar to the splint tool you used in COS217.

Editors

For those of you in touch with your systems side (this is Distributed Systems, after all), there are quite a few resources for Go development in both emacs (additional information available here) and vim (additional resources here).

As many Princeton COS students have become attached to Sublime, here are the two indispensible Sublime packages for Go development: GoSublime and Sublime-Build. And -- learning from the ancient emacs-vi holy war -- it would be inviting trouble to offer Sublime information without likewise dispensing the must-have Atom plugin: Go-Plus (walkthrough and additional info here).


Last updated: 2016-09-11 13:54:48 -0400