Go · Foundations
Learn Go
The syntax and the mental model. Short, runnable, no fluff.
Learn the Basics
01
Hello, World!
Welcome to the first tutorial. In this tutorial you will learn how to write your first line of code.
02
Variables
A variable is a name given to a storage area that the programs can manipulate.
03
Arrays
Arrays are essentially storage spaces that can be filled with as much data as one would like. Variables, unlike arrays, can only contain one piece of data.
04
Conditions and Switch
Go has one conditional statement and one switch, and both do more than their equivalents elsewhere.
05
Loops
Go has only one looping construct, the for loop.
06
Functions
Multiple return values, named results, variadics, closures — and the error convention that shapes every Go API.
07
Slices and maps
The two data structures you will use constantly, and the aliasing behaviour that surprises everyone once.
08
Structs and interfaces
Go has no classes and no inheritance. It has structs, methods and implicitly satisfied interfaces — which turns out to be enough.
09
Errors
Go's most distinctive design decision. Verbose, explicit, and the reason generated Go rarely swallows a failure.
10
Methods and Pointers
Pointers in Go are simple by design: no arithmetic, no manual freeing. The one decision you make repeatedly is value receiver or pointer receiver.
11
Strings and Runes
A Go string is a read-only slice of bytes, not characters. Understanding that distinction prevents a specific and common category of bug.
12
Packages and Modules
How Go code is organised, why a capital letter is the only access modifier you get, and what go.mod actually does.
Advanced Tutorials
01
Goroutines and channels
Go's headline feature, and the one place where the compiler stops protecting you.
02
Defer, Panic and Recover
Go's cleanup mechanism, its crash mechanism, and the narrow set of cases where catching a crash is the right thing to do.
03
Testing
Testing ships with the language. Table-driven tests, subtests, benchmarks and the race detector all come from one command.
04
JSON and File I/O
Struct tags, the reader and writer interfaces that unify all I/O in Go, and the capitalisation mistake that silently drops your fields.
05
Generics
Type parameters arrived late to Go and the community uses them sparingly. Here is the everyday use, and why restraint is the right default.
Get the Go agent pack
A battle-tested AGENTS.md, the review checklist, and the failure-mode cheat sheet for Go. One email, then occasional updates when the tooling shifts. No course pitch.
AGENTS.md now — no email needed.