CS-240 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 grading scripts will use is Go 1.15.14. The latest version as of the Fall 2021 semester is Go 1.16.7.

Manual for Various OSes

For installing 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.8.3.sierra.bottle.
######################################################################## 100.0%
==> Pouring go-1.8.3.sierra.bottle.tar.gz
==> Caveats
A valid GOPATH is required to use the `go get` command.
If $GOPATH is not specified, $HOME/go will be used by default:
  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.8.3: 7,035 files, 282.0MB
dustpuppy:~$ go version
go version go1.8.3 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 useful to print out style mistakes.

Editors

Visual Code Studio is a source-code editor made by Microsoft for Windows, Linux and macOS. It has an extension for Go that supports features like IntelliSense, code navigation, symbol search, testing, debugging, and many more that will help you in Go development.

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

If you are a Sublime user, 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: 2022-08-21 17:43