← lore

Code Like Go

boring on purpose

If you do one thing after reading this series: write code the way you'd write Go. Boring. Explicit. Small. Done.

Why Go teaches

Most languages grow by addition. Each release bolts on another way to say the same thing — a new sugar, a new abstraction, a new clever. The ceiling rises and the floor goes with it: now there are six ways to loop, four ways to handle an error, and a code review is an argument about taste.

Go grew by subtraction. No exceptions. No inheritance. No generics for a decade. No ternary. No while. No implicit conversions. One way to format code, enforced by a tool. The designers kept removing the knobs until what was left was hard to argue about. That is the whole trick. Go is the clearest case study we have of constraints as pedagogy — rm/acc applied to a language.

"Clear is better than clever." — Go proverb

When you remove the clever option, you don't lose power. You lose the decision. And the decision was the tax. Here is what's left when you strip a function down to the Go shape:

// errors are values. you check them. that's it.
func ReadConfig(path string) (*Config, error) {
    data, err := os.ReadFile(path)
    if err != nil {
        return nil, fmt.Errorf("read config %s: %w", path, err)
    }
    var c Config
    if err := json.Unmarshal(data, &c); err != nil {
        return nil, fmt.Errorf("parse config: %w", err)
    }
    return &c, nil
}

No try/catch swallowing the stack. No magic. The control flow is the source. You can read it top to bottom and know exactly what happens when the file is missing. That legibility is not an accident — it's what remains after the language designers said no, repeatedly, to features that would have hidden the path.

Boring is the feature

Clever code is a loan against the next person who reads it — usually you, in six months, with no memory of the trick. Boring code pays cash. It is slower to write and faster to live with. Go optimizes ruthlessly for the second number, because that's the one that compounds across a team and a decade.

Remove to accelerate. Fewer features, fewer ways to be wrong, fewer arguments, faster ships. The series below walks through how Go does it and how to steal the discipline regardless of what language you're stuck in.

The series

1 · Subtraction
Every feature Go refused — exceptions, inheritance, ternaries — and the bug class each refusal deleted.
2 · Principles
Errors as values. The zero value. Small interfaces. Composition over hierarchy. The rules that fall out of the removals.
3 · Patterns
Accept interfaces, return structs. Table-driven tests. Channels and CSP. context all the way down. The idioms that ship.
4 · Stories
Where the discipline paid off and where ignoring it burned. War stories from real codebases, including this one.

Read it like this

Start at Subtraction if you want the argument built from the ground up — it earns every later claim. Jump to Patterns if you already buy the philosophy and want code to copy. The throughline never changes: every Go choice is a removal that accelerated. Boring code beats clever code. Clear is better than clever.

You see the same shape in real systems. The Agents Hub documents orchestration codebases that live or die on legibility under load — and the ones that survive read like Go: small interfaces, errors as values, no cleverness left to debug at 3am.