Search tldr

GitHub - lotusirous/go-concurrency-patterns: Concurrency patterns in Go · GitHub

A Go example repository covering 18 practical concurrency patterns, from goroutines and channels to cancellation, bounded parallelism, ring buffers, and worker pools. Each pattern links to runnable Go Playground code and supporting talks or articles.

Share

GitHub - lotusirous/go-concurrency-patterns: Concurrency patterns in Go · GitHub

Author: lotusirous | Published: Unknown | Generated: 2025-01-31 | Domain: github.com
Tags: ‘#golang’ ‘#concurrency’ ‘#goroutines’ ‘#channels’ ‘#patterns’ ‘#workerpool’


TLDR

This repository is a compact, runnable catalog of Go concurrency patterns, progressing from basic goroutines and channels through fan-in, generators, timeouts, cancellation signals, and pipeline-style concurrent search. It also includes more advanced examples for subscriptions, context propagation, bounded parallelism, ring-buffer channels, and worker pools, with links to authoritative Go talks and documentation. The main value is hands-on code paired with Go Playground demos for experimenting with each technique.

Key Takeaways

  • 18 runnable examples: The repository covers goroutines, channels, generators, fan-in, sequencing, select timeouts, quit signals, daisy chains, concurrent search, ping-pong, subscriptions, contexts, ring buffers, and worker pools.
  • Progressive concurrency search: Four “Google” examples build a concurrent search implementation incrementally, illustrating how to compose parallel services and collect results.
  • Cancellation and lifecycle control: Examples include timeout handling, quit signals, and context use in HTTP clients and servers—core techniques for preventing leaked goroutines and propagating cancellation.
  • Throughput control patterns: Bounded parallelism, ring-buffer channels, and worker pools demonstrate ways to regulate work concurrency, buffer producer/consumer mismatches, and coordinate result-channel closure.
  • Curated learning material: The README links to Go’s classic concurrency talks and articles, including pipelines/cancellation, timeouts, context, and advanced concurrency patterns.
  • Repository activity: At the captured state, the project has 3.1k stars, 269 forks, 29 watchers, 30 commits, and no published releases.

Images & Media

None present in article.

Keep reading