Go
64 notes
Some notes are currently available only in Chinese. English translations are shown when available.
- 1.11 arrayhistorical
Go arrays have a fixed length and are copied during assignment and argument passing. These notes examine array usage through those properties.
- 1.12 slicehistorical
Slices provide an expandable view over fixed-length arrays. These notes introduce their structure and usage through the limits of arrays.
- 1.13 deferhistorical
defer: A mechanism that lets a function be executed after the current function finishes. Here, finishing includes both normal termination through return and abnormal termination caused by panic.
- 2.1 contexthistorical
Context carries cancellation signals, timeouts, deadlines, and key-value data between goroutines to coordinate related task lifecycles.
- 2.2 sync.WaitGrouphistorical
WaitGroup lets a goroutine wait for other goroutines to finish, using a counter to track outstanding work.
- 2.3 synchistorical
The sync package provides primitives such as locks, condition variables, Once, and WaitGroup. These notes organize their roles in concurrent programs.
- 2.4 sync.maphistorical
Sync.Map provides thread-safe key-value storage for concurrent access. These notes examine its usage scenarios, internal structure, and differences from an ordinary map.
- 2.5 sync.poolhistorical
Sync.Pool temporarily holds reusable objects so later operations can reuse them, reducing allocations and garbage-collection pressure.
- 2.6 selecthistorical
Go select waits on multiple channel operations and executes a branch when an operation can proceed, in a form similar to I/O multiplexing.
- 2.7 sync.Oncehistorical
Once guarantees that an action executes only once. These notes examine its usage and implementation through scenarios such as singletons.