Go
A deliberately small language, designed around how large teams actually fail.
- First released
- 2009 (1.0 in 2012)
- Created by
- Robert Griesemer, Rob Pike and Ken Thompson, at Google
- Typing
- Static, strong and structurally typed interfaces
- File extensions
- .go
What it is for
Docker, Kubernetes, Terraform and Prometheus are all written in Go. That is more or less the whole pitch: networked infrastructure that has to be built quickly, shipped as one file, and understood by whoever inherits it.
What makes Go Go is what was left out. No inheritance. No exceptions. No operator overloading, and for the first thirteen years, no generics. The reasoning was organizational rather than aesthetic. A language with fewer ways to say a thing produces code that reads the same regardless of who wrote it, and gofmt settles the formatting argument before anyone can start it. People who love expressive languages usually find Go tedious. People maintaining someone else's service usually find it a relief.
Two things do most of the selling. Compilation is fast enough to feel interactive, and what comes out is one static binary with no runtime to install. Then goroutines and channels make concurrency cheap enough to reach for casually. That last part is why it took over the server room.
Where it came from
Go started at Google in 2007, out of frustration with large-scale C++: slow builds, tangled dependencies, a language nobody could hold entirely in their head. Griesemer, Pike and Thompson announced it in November 2009. The last two came from Bell Labs, with Unix and Plan 9 behind them.
Go 1.0 shipped in 2012 with a compatibility promise that has largely held: code written against Go 1 still builds. That sounds dull, and it is, and it is also a substantial part of why infrastructure companies picked it up. Dependency management took longer to settle. GOPATH gave way to modules in 2018 after several false starts.
Generics landed in Go 1.18 in 2022, after more than a decade of proposals turned down for adding complexity that did not pay for itself. The result is restrained and the surrounding style has barely moved. The designers seem pleased about that.
What it is like to type
Go types fast and rewards accuracy over speed. Short names, no semicolons, gofmt's tabs. But the error-handling idiom means you will type if err != nil { return err } more times than any other line in your life, and := is a two-key sequence your fingers should learn as one motion.
128 steps across 6 tours, from the basics to complete programs.
The tours
- Language basicsGo is small enough that thirty steps genuinely covers the language. 30 steps.
- ConcurrencyThe reason people pick Go. 25 steps.
- ErrorsGo returns errors as values and the compiler will not let you forget one. 15 steps.
- Interfaces & genericsStructs and methods, then interfaces, which Go satisfies implicitly. 19 steps.
- Standard library & project layoutGo's standard library is unusually complete, and this tour is a working tour of it. 26 steps.
- TestingTesting is in the toolchain, not a library you choose. 13 steps.