Fun With Pointers
summary
Shows that pointers in Go are values copied on call so mutating a pointer itself requires a pointer-to-pointer; demonstrates the common bug where range copies prevent updating slice elements (fixed by using pointers or indexed assignment). Uses the Go compiler’s escape analysis -m output to show when locals move to the heap and why that can hurt performance. Scans GitHub public data to find up to ~1,200 files with four levels of indirection (mostly tests), explains JSON marshalling quirks solved by using a non-nil interface holding an empty struct, and shows unsafe conversions (float64↔uint64) and cgo uses.
AI-written summary · about
chapters (7)
- 0:00Introduction
- 7:10Pointers
- 12:49Values
- 13:02Indirection
- 14:52When to use pointers
- 28:07Data locality
- 31:05Summary
related talks
37mWhat's The Point? A Guide To Using Pointers Without Panicking
19mGo - Best practices
30mMemory Management in Go: The good, the bad and the ugly
53mStupid Gopher Tricks
51mObscure Go Optimisations
01h 21mA Generic Talk About Go
46mGoing Loopy: Iteration in Go
29mDissecting Slices, Maps and Channels in Go
