Go
69 notes
Some notes are currently available only in Chinese. English translations are shown when available.
- 1.11 arrayhistorical
Fixed-length arrays in Go, value semantics, range iteration, compiler representation, literal initialization, and bounds checking.
- 1.12 slicehistorical
1. What is a slice A dynamically growable array 2. Why slices are needed Arrays have a fixed number of elements and cannot grow dynamically 3. How to use slices 3.1. Basic usage 3.2. Function parameters pass the slice descriptor - although changes to the backing array are visible, append may replace the backing array, so return the slice when needed 3.3. nil slice and empty slice
- 1.13 deferhistorical
What defer is, why it is used, cleanup patterns, interaction with return values and closures, LIFO ordering, recover, and its historical runtime implementation.
- 2.1 contexthistorical
Goroutine context, deadlines, cancellation signals, request-scoped data, Context/canceler implementations, WithCancel/WithTimeout/WithValue, and references.
- 2.2 sync.WaitGrouphistorical
What sync.WaitGroup is, an example of waiting for goroutines, and its counter-based Add, Done, and Wait behavior.
- 2.3 synchistorical
An overview of the synchronization primitives provided by Go's sync package and links to Mutex, RWMutex, Cond, Once, Map, Pool, WaitGroup, and atomic.
- 2.4 sync.maphistorical
What sync.Map is, concurrency-safety approaches, usage, its read/dirty data structures, and a summary of Load, Store, Delete, and dirty-to-read promotion.
- 2.5 sync.poolhistorical
What sync.Pool is, why temporary object caching can reduce allocation and GC pressure, usage, fmt integration, source structures, Get/Put, GC cleanup, and summary.
- 2.6 selecthistorical
What select is, basic usage, random selection, empty select, nil channels, for-select exit, timeouts, quit channels, internals, and references.
- 2.7 sync.Oncehistorical
What sync.Once is, singleton usage, its atomic+Mutex implementation, and a modified version that returns an error.