Learn Go — from your first program to reading real code

A hands-on path into Go, the language GopherTrunk itself is built in. Start with why Go exists and your first compiled program, learn the type system, interfaces, and the concurrency model that makes Go shine, then finish by reading real code from a working SDR engine. No prior Go — or compiled language — experience assumed.

Go has a reputation for being small, fast, and refreshingly boring — in the best way. There is one way to format your code, one way to build it, and a concurrency model you can hold in your head. That is exactly why it powers so much modern infrastructure, and why GopherTrunk itself is written in Go: a real-time SDR engine needs speed, safety, and easy concurrency, and Go gives you all three without a heavy runtime.

Who this is for. Newcomers welcome — you do not need prior Go, and you do not need to have used a compiled language before. If you have written a little code in any language, you will move quickly. If you have not, the early lessons start from the very beginning.

How the module works. Five units take you from “why does Go exist?” to reading real code from a working SDR decoder. The first units build the language piece by piece — types, functions, errors, structs, interfaces. The middle unit covers Go’s headline feature, concurrency. The last units show how real programs are organized and tested, then walk through actual GopherTrunk code so the ideas land somewhere concrete. Mark lessons complete as you go — your progress is saved in your browser. New here? Start with lesson 1: Why Go?

Unit 1 — Meeting Go

What Go is, why it exists, and the toolchain you run every day.

  1. Why Go? Where Go came from, the problems it was built to solve, and why a fast, simple, compiled language is a great fit for systems like GopherTrunk. beginner 8 min
  2. Your first Go program Install Go, write hello world, and understand the difference between go run and go build — from source to a single static binary. beginner 9 min
  3. The Go toolchain go build, run, test, fmt, and vet — the batteries-included tools that format, check, and build your code with zero configuration. beginner 9 min

Unit 2 — Language Fundamentals

Values, control flow, functions, errors, pointers, structs, and interfaces — the core of Go.

  1. Values, variables & types Go's built-in types, declarations, zero values, and static typing — why a small, strict type set makes programs easier to reason about. beginner 9 min
  2. Control flow if, for, and switch — Go's deliberately small set of control structures, including the one loop keyword that does everything. beginner 9 min
  3. Functions & error handling Multiple return values, the error interface, and why Go returns errors instead of throwing exceptions — the pattern you'll see on every line. beginner 10 min
  4. Pointers What a pointer is, why Go has them without pointer arithmetic, and how they let functions modify values and avoid copying big structs. intermediate 9 min
  5. Structs & methods Group data with structs, attach behaviour with methods, and understand pointer vs value receivers — Go's answer to objects. intermediate 10 min
  6. Interfaces & composition Small interfaces, implicit satisfaction, and composition over inheritance — the idea that makes Go code flexible without class hierarchies. intermediate 10 min

Unit 3 — Data & Text

The collections, text, files, and encodings real programs are built from.

  1. Slices, maps & generics Go's core collections — slices and maps — how they grow and alias, plus type parameters (generics) for reusable, type-safe code. intermediate 10 min
  2. Strings, bytes & runes How Go handles text — immutable strings, byte slices, and runes — and why Unicode means a character isn't always one byte. intermediate 9 min
  3. JSON & serialization Turning Go structs into JSON and back with encoding/json, struct tags, and the marshal/unmarshal pattern behind most APIs and config. intermediate 9 min
  4. Working with files & I/O Reading and writing files and streams with os, io, and bufio — and the reader/writer interfaces that make it all composable. intermediate 9 min

Unit 4 — Concurrency

Goroutines, channels, coordination, and the patterns that put them to work.

  1. Goroutines Lightweight concurrency you launch with one keyword — what a goroutine is, how it differs from a thread, and why GopherTrunk runs thousands. intermediate 9 min
  2. Channels Typed pipes that let goroutines communicate safely — sending, receiving, buffering, and closing — Go's "share memory by communicating" model. intermediate 10 min
  3. select & synchronization Coordinate multiple channels with select, and use the sync package — mutexes, WaitGroups — when channels are not the right tool. advanced 10 min
  4. Context & cancellation The context package — how a single cancel signal or timeout propagates through every goroutine in a call tree to shut work down cleanly. advanced 9 min
  5. Concurrency patterns Worker pools, pipelines, and fan-out/fan-in — the reusable shapes for structuring concurrent work, the way a real sample pipeline does. advanced 10 min

Unit 5 — Packages & Quality

Organizing, depending on, testing, measuring, and debugging real code.

  1. Packages & modules How Go organizes code into packages and modules, how imports and go.mod work, and how visibility is controlled by capitalization. intermediate 9 min
  2. Dependency management How go.mod and go.sum pin versions, how go get and go mod tidy manage dependencies, and why reproducible builds and few dependencies matter. intermediate 9 min
  3. Error-handling patterns Beyond if err != nil — wrapping errors with %w, sentinel errors, errors.Is and errors.As, and custom error types for real programs. advanced 10 min
  4. Testing in Go The built-in testing package, table-driven tests, and why testing is a first-class part of the language, not an add-on. intermediate 9 min
  5. Benchmarking & profiling Measuring performance with benchmarks and pprof — finding the hot path before optimizing it, the way real-time DSP code demands. advanced 10 min
  6. Debugging Go Finding bugs with print debugging, the delve debugger, the race detector, and static analysis — the toolkit for when a test goes red. intermediate 9 min
  7. The standard library A tour of the batteries Go ships with — io, bytes, encoding, net, and more — and why you reach for a dependency far less often than elsewhere. intermediate 9 min

Unit 6 — Go in the Wild

Logging, project layout, idioms, and reading real code — then your next steps.

  1. Logging with slog Structured logging with the standard log/slog package — levels, fields, and why a running service logs in structured form, not just printed lines. intermediate 8 min
  2. Structuring a Go project The cmd, internal, and package conventions that shape real Go repositories — where code goes and why, using GopherTrunk's layout as the map. intermediate 9 min
  3. Writing idiomatic Go The conventions that make Go code look and read the same everywhere — naming, accepting interfaces, handling errors, and avoiding cleverness. intermediate 9 min
  4. Reading a real Go codebase A guided tour of how a working SDR engine like GopherTrunk is structured in Go — packages, interfaces, and goroutines you can now recognize. advanced 11 min
  5. Where to go next Idiomatic Go, the tooling ecosystem, the community, and a short project ladder to take you from this path to shipping your own Go programs. beginner 8 min
  1. Glossary of Go terms Plain-language definitions for every Go term in the path — goroutine, channel, interface, slice, struct, method, package, module, and more — cross-linked to the lessons.