A drop-in alternative to Go's sync/errgroup with configurable goroutine worker limits for rate-limited operations.
neilotoole/errgroup is a Go package that extends the standard library's sync/errgroup with configurable goroutine limits. It solves the problem of unbounded goroutine creation when working with rate-limited APIs, databases, or other constrained resources by providing worker pool semantics while maintaining the same API interface.
Go developers building concurrent applications that interact with rate-limited external services, databases with connection limits, or any system where controlling goroutine concurrency is necessary.
Developers choose this package because it provides a drop-in replacement for sync/errgroup with added concurrency control, allowing them to limit goroutine creation without changing their existing error group patterns, and it can offer performance benefits for specific workloads when properly tuned.
errgroup with goroutine worker limits
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Adds worker pool semantics with the numG parameter, allowing precise control over goroutine counts to prevent overloading external systems like rate-limited APIs.
Provides qSize to set work queue channel capacity, enabling backpressure control and potential performance optimization for specific workloads.
Maintains identical API to sync/errgroup, requiring only an import path change for easy migration from the standard library version.
Benchmarks in the README show it can outperform sync/errgroup for CPU-intensive tasks when numG and qSize are properly tuned.
The README explicitly states the package is no longer maintained since sync/errgroup incorporated SetLimit, making it obsolete for new development.
The Go method blocks when the work queue is full, unlike sync/errgroup's non-blocking approach, which can lead to deadlocks or reduced responsiveness if not accounted for.
Requires benchmarking and tuning of numG and qSize for optimal performance, adding complexity compared to the standard library's simpler, auto-scaled model.