Goal
Solve the Protohackers server-programming challenges in Go, in order. Each problem is
graded by a live checker hammering your public endpoint, so correctness under concurrency
is non-negotiable — exactly the muscle Go's goroutines-and-channels model exists for.
Rule of the ladder: every rung passes go test -race and the online checker before the
next begins.
Subject: full brief & instructions
Practices
- Deep dive Go — goroutine-per-connection, channels vs.
sync,contextcancellation, the race detector: the concept's whole concurrency story. - Networking fundamentals — TCP vs. UDP semantics, framing, and byte-order, learned by being punished for guessing.
- WebSockets & bidirectional protocols — the same long-lived-connection patterns these servers hand-roll.
Milestones
- Smoke Test. TCP echo server: accept loop, goroutine per connection, clean EOF handling. The skeleton every later rung reuses.
- Prime Time. Newline-delimited JSON protocol:
bufioscanning, per-request validation, malformed-input responses — your first wire format. - Means to an End. Binary protocol (9-byte messages, big-endian):
encoding/binary, per-connection state, no shared state yet. - Budget Chat. The shared-state rung: a chat room with joins, leaves, and broadcast. Solve it twice — once with a mutex-guarded map, once with a monitor goroutine owning the state via channels — and form an opinion.
- Unusual Database Program. UDP key-value store: datagram semantics, no connections, why retries and idempotency suddenly matter.
- Mob in the Middle. A malicious proxy rewriting Budget Chat traffic in flight: concurrent bidirectional copying, partial reads, and the tightest test of your framing discipline so far.
Stretch goals
- Keep climbing: Speed Daemon and beyond are substantial distributed-ish builds.
pprofa server under checker load; find your allocation hot spots.- Re-solve one rung in Rust with Tokio and compare with Tokio mini-redis.
Related
- Deep dive Go — the concept note whose
# Practicecites this ladder. - Protohackers ladder — subject — the per-rung problem statements and acceptance checks.
- Networking fundamentals — the protocol layer underneath every rung.
- Tokio mini-redis — the same territory under Rust's async model.