A collection of real world advice for writing maintainable Go programs.
Presentations
Fundamentals
- What is the zero value, and why is it useful?
- The empty struct
- On declaring variables
- Go has both make and new functions; what gives?
- Should methods be declared on T or *T?
- Slices from the ground up
- If a map isn’t a reference, what is it?
- A variable’s name should be independent of its type
Commentary
Package design
Project design
API design
- Functional options for friendly APIs
- Don’t force allocations on the callers of your API
- Be wary of functions which take several parameters of the same type
Error handling
- Don’t just check errors, handle them gracefully
- Inspecting errors
- Constant errors
- Errors vs exceptions (part 1, part 2, part 3)
- Eliminate error handling by eliminating errors
Logging
Concurrency
- Curious Channels
- Channel axioms
- Ice cream makers and data races
- Never start a goroutine without knowing how it will stop
- Context isn’t for cancellation