Go
Go 1.27 from a first program to production services: types and slices, interfaces and errors, generics, concurrency, testing, HTTP, databases and tooling.
82 lessons: 22 free with Pro answers and 60 with a free core.
Examples run with Go 1.27.1.
Who it is for
Back-end and cloud developers, and Python or Java developers moving to Go.
What you will be able to do
- Install the Go 1.27 toolchain, run and build programs, and find answers in go doc and the specification
- Write programs with Go's values, types, control flow, functions, closures and defer
- Use arrays, slices, maps and strings correctly, and predict what append and copying do
- Model data with structs, methods, embedding and interfaces, and handle errors as values
- Organise code in packages and modules, and test it with table tests, fuzzing and benchmarks
- Write generic code, including generic methods, and iterate with range-over-func iterators
- Write concurrent programs with goroutines, channels, sync and context, and find races and leaks
- Build HTTP and JSON services, database code, gRPC services and command-line tools
- Profile, observe and secure Go services, and explain what the runtime does underneath
- Answer Go interview and code-review questions with programs that prove each claim
Revise and practise
- Practice: every exercise and quiz (82 quizzes)
Modules and lessons
What the labels mean
- Free lesson, Pro answers
- the whole lesson is free; the model answers to its interview questions open with a pass
- Free core, Pro depth
- the core of the lesson is free; its in-depth parts open with a pass
- Pro
- opens with a Pro, Premium or Ultimate pass
Minutes are reading time: “5 of 15 min free” means 5 minutes of the lesson are free.
What a pass opens in this track
124 in-depth parts and 227 interview answers. The same pass opens every other track and every Pro tool.
- Module 1
Getting started with Go 1.27
What Go is for, installing the 1.27 toolchain, first programs and finding answers in the official docs.
- What Go is and where it fits Free lesson, Pro answers: 15 minutes
- Install Go 1.27 and set up your editor Free lesson, Pro answers: 15 minutes
- Your first Go program: go run and go build Free lesson, Pro answers: 15 minutes
- Find answers: go help, go doc and pkg.go.dev Free lesson, Pro answers: 15 minutes
- Module 2
Basics: values, types and control flow
Variables, zero values, numeric types, constants and iota, operators, control flow, fmt and input.
- Variables, short declarations and zero values Free lesson, Pro answers: 15 minutes
- Basic types: numbers, strings, bools, conversion Free core, Pro depth: 5 of 15 minutes free
- Constants, untyped values and iota Free core, Pro depth: 4 of 10 minutes free
- Operators, precedence and bit manipulation Free core, Pro depth: 4 of 10 minutes free
- Control flow: if, for, range and switch Free core, Pro depth: 6 of 15 minutes free
- Formatted output with fmt: verbs and widths Free core, Pro depth: 4 of 10 minutes free
- Reading input: lines, arguments and fast I/O Free core, Pro depth: 5 of 15 minutes free
- Module 3
Functions, closures and defer
Functions and multiple results, closures and per-iteration loop variables, defer, panic and recover.
- Functions, multiple results and variadics Free lesson, Pro answers: 10 minutes
- Closures: captured variables and loop variables Free core, Pro depth: 6 of 15 minutes free
- defer, panic and recover Free core, Pro depth: 5 of 15 minutes free
- Module 4
Arrays, slices, maps and strings
Value semantics of arrays, slice internals and aliasing, the slices and maps packages, UTF-8 strings and number parsing.
- Arrays are values: length, copies, comparison Free lesson, Pro answers: 10 minutes
- Slices: length, capacity, append and aliasing Free core, Pro depth: 5 of 15 minutes free
- The slices package: sort, search and compare Free core, Pro depth: 6 of 15 minutes free
- Maps: lookups, sets, iteration and gotchas Free core, Pro depth: 6 of 15 minutes free
- Strings, bytes and runes: UTF-8 done right Free core, Pro depth: 6 of 15 minutes free
- Numbers as text: strconv, bases and grouping Free core, Pro depth: 6 of 15 minutes free
- Module 5
Structs, pointers and methods
Struct types and literals (including Go 1.27 promoted-field keys), pointers and new(expr), methods, embedding and constructors.
- Structs and struct literals, including Go 1.27 Free lesson, Pro answers: 15 minutes
- Pointers, new and escape analysis Free core, Pro depth: 6 of 15 minutes free
- Methods: value and pointer receivers Free core, Pro depth: 6 of 15 minutes free
- Embedding: composition instead of inheritance Free core, Pro depth: 6 of 15 minutes free
- Constructors, useful zero values and options Free core, Pro depth: 6 of 15 minutes free
- Module 6
Interfaces and type assertions
Implicit interfaces, interface values and the typed-nil trap, assertions and switches, standard interfaces, streaming I/O and enum patterns.
- Interfaces: implicit, small and consumer-defined Free lesson, Pro answers: 15 minutes
- Interface values, dynamic types and the nil trap Free core, Pro depth: 6 of 15 minutes free
- Type assertions and type switches Free core, Pro depth: 6 of 15 minutes free
- Interfaces you will meet: Stringer to Handler Free core, Pro depth: 6 of 15 minutes free
- Streaming data: io.Reader and io.Writer Free core, Pro depth: 6 of 15 minutes free
- Enums and sum types: Go patterns that work Free core, Pro depth: 6 of 15 minutes free
- Module 7
Errors: values, wrapping, Is, As and AsType
The error convention, wrapping and inspection (including errors.AsType from Go 1.26), custom error types and when to panic.
- Errors are values: returning and checking them Free lesson, Pro answers: 10 minutes
- Wrapping errors: %w, Is, As, AsType and Join Free core, Pro depth: 6 of 15 minutes free
- Custom error types and error design for APIs Free core, Pro depth: 6 of 15 minutes free
- When to panic: runtime errors and Must helpers Free core, Pro depth: 6 of 15 minutes free
- Module 8
Coming from Python or Java
Translation guides for the two most common first languages of Go developers, and the idioms reviewers expect.
- Go for Python developers: a translation guide Free lesson, Pro answers: 15 minutes
- Go for Java developers: a translation guide Free core, Pro depth: 5 of 15 minutes free
- Idiomatic Go: naming, comments and style guides Free core, Pro depth: 6 of 15 minutes free
- Module 9
Packages, modules and dependencies
Packages and visibility, go.mod and version selection, toolchains and GODEBUG, vetting dependencies, workspaces and private modules, layout and publishing.
- Packages, exported names and initialisation Free lesson, Pro answers: 15 minutes
- Module 10
Testing, fuzzing and benchmarks
go test, table-driven tests, fakes and httptest, native fuzzing, b.Loop benchmarks, coverage and Example tests.
- Unit tests with go test Free lesson, Pro answers: 20 minutes
- Table-driven tests, subtests and golden files Free core, Pro depth: 8 of 20 minutes free
- Fakes, interfaces and httptest Free core, Pro depth: 8 of 20 minutes free
- Native fuzzing with go test -fuzz Free core, Pro depth: 6 of 15 minutes free
- Benchmarks with b.Loop Free core, Pro depth: 6 of 15 minutes free
- Coverage, examples and test output Free core, Pro depth: 8 of 20 minutes free
- Module 11
Generics, including generic methods (1.27)
Type parameters and inference, constraints and type sets, generic types and aliases, Go 1.27 generic methods, self-referential constraints and performance.
- Type parameters: generic functions and inference Free lesson, Pro answers: 15 minutes
- Constraints, type sets and cmp.Ordered Free core, Pro depth: 6 of 15 minutes free
- Generic types, data structures and type aliases Free core, Pro depth: 6 of 15 minutes free
- Generic methods in Go 1.27 Free core, Pro depth: 6 of 15 minutes free
- Advanced generics: inference and self-reference Free core, Pro depth: 6 of 15 minutes free
- Generics in practice: performance and API design Free core, Pro depth: 6 of 15 minutes free
- Module 12
Iterators and range-over-func
Push iterators with iter.Seq, the standard library's iterator functions, pull iterators and lazy generic pipelines.
- Range-over-func iterators with iter.Seq Free lesson, Pro answers: 15 minutes
- Iterators in slices, maps, strings and reflect Free core, Pro depth: 7 of 20 minutes free
- Pull iterators and lazy pipelines with generics Free core, Pro depth: 8 of 20 minutes free
- Module 13
Goroutines, channels and sync
Goroutines and the scheduler, channels, select and timers, WaitGroup.Go and mutexes, atomics and the memory model, the race detector and synctest virtual time.
- Goroutines and the Go scheduler Free lesson, Pro answers: 15 minutes
- Channels: unbuffered, buffered, closed and nil Free core, Pro depth: 6 of 15 minutes free
- select, timeouts, timers and tickers Free core, Pro depth: 5 of 15 minutes free
- sync: WaitGroup.Go, Mutex, RWMutex and Once Free core, Pro depth: 6 of 15 minutes free
- Atomics and the Go memory model Free core, Pro depth: 7 of 20 minutes free
- Testing concurrent Go code with synctest Free core, Pro depth: 8 of 20 minutes free
- Module 14
context and cancellation
Cancellation, deadlines and values with context, cancellation causes and AfterFunc, and deadline budgets across a service.
- context: cancellation, deadlines and values Free lesson, Pro answers: 15 minutes
- Cancellation causes, AfterFunc and WithoutCancel Free core, Pro depth: 8 of 20 minutes free
- Deadlines across a service: budgets and retries Free core, Pro depth: 7 of 20 minutes free
- Module 15
Concurrency patterns in Go
Pipelines, worker pools and semaphores, errgroup, rate limiting, goroutine-leak detection, caches, singleflight and pub/sub.
- Pipelines, fan-out and fan-in Free lesson, Pro answers: 15 minutes
- Worker pools, semaphores and bounded parallelism Free core, Pro depth: 8 of 20 minutes free
- Goroutine leaks and the goroutineleak profile Free core, Pro depth: 6 of 15 minutes free
- Concurrent caches, singleflight and pub/sub Free core, Pro depth: 6 of 15 minutes free
- Module 16
Standard library essentials
Files and io/fs, traversal-safe access with os.Root, time and IST time zones, slog, regexp and templates, crypto, randomness and uuid.
- Files, directories and io/fs Free lesson, Pro answers: 10 minutes
- Safe file access with os.Root Free core, Pro depth: 6 of 15 minutes free
- Time, durations, layouts and time zones (IST) Free core, Pro depth: 6 of 15 minutes free
- Structured logging with slog Free core, Pro depth: 4 of 10 minutes free
- Regular expressions (RE2) and HTML templates Free core, Pro depth: 6 of 15 minutes free
- Hashing, randomness, UUIDs and password storage Free core, Pro depth: 6 of 15 minutes free
- Module 17
JSON: encoding/json and encoding/json/v2
encoding/json with omitzero and streaming, the Go 1.27 encoding/json/v2 and jsontext packages, and a safe migration plan.
- JSON with encoding/json: tags, omitzero, streams Free lesson, Pro answers: 15 minutes
- JSON v2 in Go 1.27: encoding/json/v2 and jsontext Free core, Pro depth: 8 of 20 minutes free
- Migrating a service from JSON v1 to v2 safely Free core, Pro depth: 8 of 25 minutes free
- Module 18
HTTP servers and clients with net/http
ServeMux patterns, middleware, JSON APIs with validation, production server settings, robust clients, HTTP testing and framework choices.
- HTTP servers with ServeMux method and path patterns Free lesson, Pro answers: 15 minutes
- Middleware, request context and ResponseController Free core, Pro depth: 10 of 25 minutes free
- JSON APIs: decoding limits, validation and errors Free core, Pro depth: 7 of 20 minutes free
- Production servers: timeouts, shutdown, TLS, CSRF Free core, Pro depth: 8 of 25 minutes free
- Module 22
Tooling: vet, fix, linters, generate and builds
Static analysis, go fix modernizers, code generation with tool directives, builds and cross-compilation, cgo and WebAssembly.
- go vet, staticcheck and golangci-lint Free lesson, Pro answers: 15 minutes
- Modernise code with go fix and //go:fix inline Free core, Pro depth: 6 of 15 minutes free
Related tools
Official documentation
- Documentation (Go) (The Go Authors)
- The Go Programming Language Specification (The Go Authors)
- Go 1.27 Release Notes (The Go Authors)
- Effective Go (The Go Authors)