Fun with Functions
summary
Shows concrete patterns: functions are used as values, sent over channels and executed (functions over channels), and tests embed locally defined helpers for clear input→output checks. Demonstrates the client option pattern for configurable timeouts, and uses small state machines where handlers return closures that capture state (closure-as-state), with handler funcs satisfying an event interface (handler func implements interface). Notes pitfalls: goroutines capturing context and waiting on closed channels can leak or block, and naive waiting for channel close hurts latency.
AI-written summary · about
