← the guideMulticore & Missions

§ 02 — Eras · 2009

Go

boring by design — fast builds, safe concurrency

Left: era context, features, and the 101 hello. Right: 3 core concepts, 3 deeper 201 lessons, the factorial specimen, and where Go lives today — each column scrolls on its own.

creators
Rob Pike, Ken Thompson, Robert Griesemer, Google, 2009
status
alive (dominant infra) · Docker, Kubernetes, cloud-native everything

The problem it solves

Google’s builds were slow and its concurrency error-prone. Go bet everything on simplicity, speed, and CSP channels.

The problem it carries

Simplicity enforced: no generics for thirteen years, if err != nil as a lifestyle, and runtime magic under a plain exterior.

Key features

goroutines and channels
CSP concurrency as syntax: go, make(chan), and a receive operator.
multiple return values
Errors are ordinary return values, not exceptions or sentinels.
implicit interfaces
Any type with the right methods satisfies the interface — no declaration required.
fast builds
One toolchain and sub-second compiles, which is a feature the whole ecosystem feels.

101 — hello, world

Session one is the smallest program that still counts as speaking Go: what every tutorial prints first, in the dialect that mattered when the language arrived (2009).

the first program2009
package main

import "fmt"

func main() {
  fmt.Println("Hello, world")
}

101First contact — hello world and 3 ideas that define how Go reads. 201 — 3 lessons on mechanisms you meet after the factorial specimen: the sharp edges practitioners actually use.

101 — core concepts

3 fragments, each naming a habit of mind in Go. Read the note, then the code — together they are the 101 in one sitting.

01 — multiple returns

Errors are values, returned, not thrown — if err != nil is the lifestyle.

func parse(s string) (int, error) {
  n, err := strconv.Atoi(s)
  return n, err
}

02 — structs & methods

No classes: data plus methods, composition over inheritance.

type Ship struct{ Tons int }

func (s Ship) Heavy() bool {
  return s.Tons > 20
}

03 — goroutines & channels

Hoare’s CSP as syntax: start a goroutine with go, meet on a typed channel.

ch := make(chan string)
go func() { ch <- "done" }()
fmt.Println(<-ch)

201 — going deeper

The 201 assumes you have read the 101 and the specimen. Each lesson is one mechanism — what it is for, how it looks in code, and the trap or payoff that makes Go distinctive at scale.

  1. error wrapping
  2. context and cancellation
  3. concurrency patterns

error wrapping

Wrapping preserves the cause and adds context; errors.Is and errors.As let callers check for a specific failure deep in the chain.

if err != nil {
  return fmt.Errorf("load crew %s: %w", id, err)
}

context and cancellation

A context carries deadlines and cancellation down the call tree, so a request that is abandoned stops the work it started.

ctx, cancel := context.WithTimeout(ctx, 2*time.Second)
defer cancel()
result, err := fetch(ctx, url)

concurrency patterns

Worker pools, errgroup and sync primitives — the practical patterns that Go’s goroutines and channels are meant to express.

g, ctx := errgroup.WithContext(ctx)
for _, url := range urls {
  url := url
  g.Go(func() error { return fetch(ctx, url) })
}
err := g.Wait()

The specimen — factorial

The channel: goroutines meet on typed pipes — Hoare’s CSP made ordinary, concurrency made a primitive.

the channel2009
ch := make(chan string)
go func() { ch <- "done" }()
fmt.Println(<-ch)

Run it today

installbrew install go

rungo run fact.go

Where it is now

The cloud runs on it: Docker, Kubernetes, Terraform, most CNCF projects — everywhere ops meets code.