Skip to content

Concurrency

Chapters on goroutine lifecycle, channel-based event observation, mock-driven run loops with transport providers, and shutdown verification via context cancellation and stop signals.

Chapters

  • chapter-20-channel-delivery-tests.md — Channel Delivery Tests — fan-out work to workers via buffered channels with graceful channel-close shutdown
    Source: chapters/chapter-20-channel-delivery-tests/
  • chapter-21-panic-recovery.md — Panic Recovery in Tests — defer recover() converts panics to errors for safe testing of edge cases
    Source: chapters/chapter-21-panic-recovery/
  • chapter-22-goroutine-run-loops.md — Goroutine Run Loops — select-based event loops with context cancellation and started-channel synchronization
    Source: chapters/chapter-22-goroutine-run-loops/
  • chapter-33-event-driven-run-loop.md — Event-Driven Run Loop Tests — Run() returns an event channel, before/after lifecycle with testify.Mock, select-with-timeout event capture, and two-phase shutdown verification
    Source: chapters/chapter-33-event-driven-run-loop/

Running the code

Each chapter is a standalone Go module. To run tests for a chapter:

cd <source-directory>
go test -v ./...