Pages

Topics

Tools

↑↓navigate↵openescclose

Go guides

Every published Go guide, newest first, with practical examples you can copy into your own project.

3,815 guides across 14 topics

Topics

Latest Go guides

3D illustration of Go hash map buckets allocating key-value pairs with concurrency shields and delete indicators
Go

Go Maps: Hash Map Internals, Concurrency Safety, and delete Operations

Nil map semantics, comparability rules for keys, concurrent access that kills the process, non-addressable values, and growth that never shrinks.

GoData StructuresMemory
3D illustration of a LIFO stack of deferred cleanup gears intercepting an emergency panic shockwave and recovering
Go

Go defer, panic, and recover: Control Flow, Resource Cleanup, and Pitfalls

Deferred calls run LIFO with arguments captured at the defer, recover only works in the panicking frame's deferred function, and defer inside a loop leaks until the function returns.

GoError HandlingControl Flow
3D illustration of a three-word slice header pointing into a contiguous memory array that expands when capacity is exceeded
Go

Go Slices vs Arrays: Slice Header, Length, Capacity, and append Mechanics

The three-word slice header, why append sometimes writes into another slice's memory, how the three-index slice prevents it, and where capacity hints and clearing matter.

GoData StructuresMemory
3D illustration of concurrent thread gates regulated by glowing mutex locks and a WaitGroup barrier counter
Go

Go sync Package: Mutex, RWMutex, WaitGroup, and sync.Once Explained

The primitives that make shared memory safe in Go, the reentrancy and copying traps that break them silently, and when sync.Once or sync.Cond beats a plain mutex.

GoConcurrencySynchronization
3D illustration of generic container brackets accepting diverse data types constrained by comparable union rules
Go

Go Generics: Type Parameters, Constraints, any, and comparable

Type parameter syntax, what the tilde in a constraint union actually admits, where inference stops, and why a struct containing a slice cannot satisfy comparable.

GoGenericsData Structures
3D illustration of Go goroutine branches propagating cancellation signals down a tree hierarchy with stopwatch timers
Go

Go Context: Cancellation, Deadlines, Timeouts, and Context Values

How context cancellation propagates down a call tree, why every CancelFunc must be called, how deadlines negotiate with parents, and what belongs in a context value.

GoConcurrencyBackend
Go struct blocks contrasted with pointer addresses and value copies
Go

Go Structs and Pointers: Value vs Pointer Receivers, Embedding, and Memory

Value and pointer receivers, shallow copies, addressability, embedding, and struct layout: the rules that decide when a method mutates, when a copy diverges, and why field order changes size.

GoData StructuresBackend
Layered error capsules scanned to reveal a sentinel error core inside
Go

Go Error Handling: errors.Is, errors.As, Sentinel Errors, and Custom Types

errors.Is and errors.As explained through the wrapping that makes them necessary: %w chains, multiple wrapped errors, custom Is methods, and the pointer rules that make As panic.

GoError HandlingBackend
An abstract interface socket accepting matching struct blocks with teal accents
Go

Go Interfaces: Implicit Implementation, Type Assertions, and Type Switches

Implicit interface satisfaction in Go: method sets and receiver kinds, type assertions versus type switches, the typed-nil interface, and the compile errors that name the missing method.

GoInterfacesBackend
Go gopher data pipelines streaming packets into synchronized channel hubs with select switches
Go

Go Goroutines and Channels: Concurrency Patterns, Buffered Channels, and select

Go concurrency from the channel up: what an unbuffered send waits for, how select chooses, why goroutines leak, and the worker pool, timeout, and fan-in patterns that prevent it.

GoConcurrencyBackend