Course › Before Week 1 · 5 min
Day 0: Set up Go
Install Go 1.27, an editor that understands Go, and the two free companions. 30 minutes.
Four things to install or bookmark, about 30 minutes in total: Go itself (one download gives you the compiler, the formatter, the test runner and the package manager), an editor that understands Go, staticcheck, and the two free companions you will use next to every lesson.
Every program in this course was built with Go 1.27.4, and every compiler message and program output on the site was recorded from it. A newer Go 1.x builds the same code: Go promises that a program written for Go 1 keeps compiling on every later 1.x release.
Install Go
Download the installer for your system from go.dev/dl. On macOS and Windows it is a normal installer (.pkg or .msi) that puts Go on your PATH. On a Mac with Homebrew, brew install go works too.
On Linux
The official instructions: unpack the archive into /usr/local/go, then add its bin folder to your PATH (put the export line in ~/.profile to keep it).
curl -LO https://go.dev/dl/go1.27.4.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.27.4.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
Remove the old /usr/local/go first, as above: unpacking a new version on top of an old one leaves broken files behind.
Check it
Open a new terminal so it picks up the new PATH, then:
go version
go version go1.27.4 linux/amd64The last part is your system and processor: on an Apple Silicon Mac it says darwin/arm64.
That one go command is the whole toolchain. go build compiles, go run compiles and runs, go test runs tests, go fmt formats, go vet finds suspicious code, and go get downloads packages. In PHP terms it is php, Composer, PHPUnit and Pint in one program.
An editor that understands Go
You want the compiler’s complaints while you type, not only when you build. That comes from gopls, the official Go language server, written by the Go team.
| Editor | What to install |
|---|---|
| VS Code | The Go extension by the Go Team at Google. The first time you open a .go file it offers to install gopls and its tools: accept. |
| GoLand | JetBrains’ Go IDE. It feels like PhpStorm and needs nothing extra, but it is paid after a 30-day trial. |
Both format the file every time you save it. Go has exactly one code style, the one gofmt produces, and almost every Go project uses it. You never configure it, and you never discuss it in a code review.
Hover any name to see its type and its documentation. Most early questions are answered that way.
Install staticcheck
go vet comes with Go and catches real mistakes. staticcheck is the linter most Go teams add on top: it finds dead code, ignored errors, deprecated functions and simpler ways to write the same thing. Think Larastan next to PHP’s own syntax check. Every program on this site passes both.
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck -version
staticcheck 2026.2.2 (0.8.2)go install downloads a program’s source, compiles it, and puts the binary in ~/go/bin. If the shell says staticcheck: command not found, add that folder to your PATH the same way as above: export PATH=$PATH:$HOME/go/bin.
The two companions
Each lesson is short on purpose. Both of these are free, and each lesson says which pages to do that day.
| Companion | What it is |
|---|---|
| A Tour of Go | The Go team’s own interactive introduction: a short page per idea with a program you edit and run in the browser. You do a few pages a day in Weeks 1–4. |
| Learn Go with Tests | A free book by Chris James that teaches each language feature by writing its tests first. From Week 2 on, its chapters are the day’s longer exercises. |
A Tour of Go runs in your browser, so there is nothing to install. If you want it offline, go install golang.org/x/website/tour@latest and then tour.
How to study each day
RuleNever copy and paste a program from this site. Type it, break it on purpose, and read what the compiler says.
Go’s compiler messages are short: the file, the line, the column and one sentence. Learning to read them takes a few days, and you only learn it by seeing many of them.
Every error message on this site is real: each program was built with the go command, and the site shows exactly what it printed. If you type the same code, you will see the same error.
From Day 1 on
Run go vet ./... and staticcheck ./... before every commit. Put every tool you build in its own GitHub repository with a short README: by the end of Week 5 you will have four.
Ready: Day 1 creates your first module with the go command.