Goroutines

54 projects

Goroutines are cheap, but unbounded concurrency, lost errors and leaked goroutines are common bugs. Libraries here help in three ways: worker pools that cap how many goroutines run at once, structured concurrency helpers that wait for a group of tasks and propagate errors and panics, and channel-based toolkits for pipelines. Some also offer futures, promises and goroutine-local storage.

The standard library and golang.org/x/sync cover a lot: sync.WaitGroup waits for tasks, errgroup collects the first error, cancels a shared context and can limit concurrency with SetLimit, and semaphore bounds access to resources. Beyond that, panjf2000/ants is the most used pool and reuses goroutines to reduce allocation under heavy load. Sourcegraph's conc offers structured concurrency, catching panics in child goroutines and rethrowing them in the caller. alitto/pond and gammazero/workerpool are simpler pools, destel/rill provides composable channel-based stages with batching and ordered results, and flowmatic offers structured helpers too. tunny has been quiet since 2023.

Try errgroup with SetLimit before adding a dependency; it handles most fan-out work with cancellation. Use conc when panics in workers must not crash the process silently, and a pool like ants or pond when you submit many small tasks over the life of a program. Always pass a context so work stops when the caller gives up.

antsby panjf2000

A high-performance and low-cost goroutine pool in Go.

github.com/panjf2000/ants/v2Go 1.19+ 2 dependenciesv2.12.0updated 1mo ago

14.5k

concby sourcegraph

Conc is your toolbelt for structured concurrency in go, making common tasks easier and safer.

github.com/sourcegraph/concGo 1.20+ 1 dependencyv0.3.0updated 2mo ago

10.4k

tunnyby Jeffail

Goroutine pool for golang.

github.com/Jeffail/tunnyGo 1.13+ No dependencies updated 3y ago

4k

goworkerby benmanns

Goworker is a Go-based background worker.

github.com/benmanns/goworkerGo 1.14+ 4 dependenciesupdated 1mo ago

2.8k

pondby alitto

Minimalistic and High-performance goroutine worker pool written in Go.

github.com/alitto/pond/v2Go 1.20+ No dependencies v2.7.3updated 9d ago

2.2k

rillby destel

Go toolkit for clean, composable, channel-based concurrency.

github.com/destel/rillGo 1.25+ No dependencies v0.9.0updated 1mo ago

1.9k

workerpoolby gammazero

Goroutine pool that limits the concurrency of task execution, not the number of tasks queued.

github.com/gammazero/workerpoolGo 1.26+ 1 dependencyv1.3.0updated 13d ago

1.5k

grpoolby ivpusic

Lightweight Goroutine pool.

v1.0.0updated 7y ago

731

poolby go-playground

Limited consumer goroutine or unlimited goroutine pool for easier goroutine handling and cancellation.

v3.1.1updated 5y ago

721

gowpby xxjwxc

Gowp is concurrency limiting goroutine pool.

github.com/xxjwxc/gowpGo 1.13+ 3 dependenciesupdated 2y ago

517

flowmaticby carlmjohnson

Structured concurrency made easy.

github.com/carlmjohnson/flowmaticGo 1.21+ 1 dependencyv0.23.4updated 1y ago

404

asyncby reugn

An alternative sync library for Go (Future, Promise, Locks).

github.com/reugn/asyncGo 1.23+ No dependencies v0.10.0updated 9mo ago

318

go-actorby vladopajic

A tiny library for writing concurrent programs using actor model.

github.com/vladopajic/go-actorGo 1.22+ 3 dependenciesv1.2.0updated 5d ago

313

routineby timandy

Routine is a ThreadLocal for go library. It encapsulates and provides some easy-to-use, non-competitive, high-performance goroutine context access interfaces, which can help you access coroutine context information more gracefully.

github.com/timandy/routineGo 1.18+ 1 dependencyv1.1.6updated 3mo ago

291

go-flocby workanator

Orchestrate goroutines with ease.

github.com/workanator/go-floc/v3Go 1.12+ No dependencies updated 5y ago

268

go-flowby kamildrazkiewicz

Control goroutines execution order.

1.0updated 7y ago

221

artifexby borderstech

Simple in-memory job queue for Golang using worker-based dispatching.

github.com/mborders/artifexGo 1.20+ 2 dependenciesv0.5.1updated 5mo ago

214

semaphoreby marusama

Fast resizable semaphore implementation based on CAS (faster than channel-based semaphore implementations).

github.com/marusama/semaphore/v2Go 1.11+ No dependencies v2.5.0updated 5y ago

178

neilotoole/errgroupby neilotoole

Drop-in alternative to sync/errgroup, limited to a pool of N worker goroutines.

github.com/neilotoole/errgroupGo 1.14+ 1 dependencyupdated 3y ago

162

cyclicbarrierby marusama

CyclicBarrier for golang.

github.com/marusama/cyclicbarrierGo 1.11+ No dependencies v1.1.0updated 6y ago

158

asyncby studiosol

A safe way to execute functions asynchronously, recovering them in case of panic.

github.com/StudioSol/asyncGo 1.13+ No dependencies v1.0.0updated 5y ago

138

gollbackby vardius

Asynchronous simple function utilities, for managing execution of closures and callbacks.

github.com/vardius/gollback/v2Go 1.26+ No dependencies v2.0.0updated 2d ago

121

go-futureby jizhuozhi

A Future/Promise library with generic combinators and a DAG execution engine.

github.com/jizhuozhi/go-futureGo 1.18+ 1 dependencyv0.2.2updated 1mo ago

106

Hunchby AaronJan

Hunch provides functions like: All, First, Retry, Waterfall etc., that makes asynchronous flow control more intuitive.

archived

103

threadpoolby shettyh

Golang threadpool implementation.

github.com/shettyh/threadpoolGo 1.14+ No dependencies 0.1.4updated 6y ago

103

semaphoreby kamilsk

Semaphore pattern implementation with timeout of lock/unlock operations based on channel and context.

github.com/kamilsk/semaphore/v5Go 1.11+ 1 dependencyv4.4.1updated 3mo ago

102

worker-poolby vardius

Goworker is a Go simple async worker pool.

github.com/vardius/worker-pool/v3Go 1.26+ No dependencies v3.0.0updated 2d ago

93

gpoolby Sherifabdlnaby

Manages a resizeable pool of context-aware goroutines to bound concurrency.

github.com/sherifabdlnaby/gpoolGo 1.25+ 1 dependencyupdated 3mo ago

89

goccmby zenthangplus

Go Concurrency Manager package limits the number of goroutines that allowed to run concurrently.

github.com/zenthangplus/goccmGo 1.14+ No dependencies v1.1.3updated 3y ago

73

gowlby hamed-yousefi

Gowl is a process management and process monitoring tool at once. An infinite worker pool gives you the ability to control the pool and processes and monitor their status.

github.com/hamed-yousefi/gowlGo 1.17+ 1 dependencyv0.2.1updated 20d ago

73

nurseryby arunsworld

Structured concurrency in Go.

github.com/arunsworld/nurseryGo 1.13+ No dependencies updated 5y ago

71

routineby x-mod

Go routine control with context, support: Main, Go, Pool and some useful Executors.

github.com/x-mod/routineGo 1.14+ 4 dependenciesupdated 5mo ago

63

gohiveby loveleshsharma

A highly performant and easy to use Goroutine pool for Go.

github.com/loveleshsharma/gohiveGo 1.21+ 2 dependenciesupdated 2y ago

54

kyooby dirkaholic

Provides an unlimited job queue and concurrent worker pools.

github.com/dirkaholic/kyooGo 1.20+ 1 dependencyv1.0.0updated 7mo ago

50

go-waitgroupby pieterclaerhout

Like sync.WaitGroup with error handling and concurrency control.

github.com/pieterclaerhout/go-waitgroupGo 1.13+ 2 dependenciesv1.0.7updated 2mo ago

49

parallel-fnby rafaeljesus

Run functions in parallel.

updated 8y ago

37

go-trylockby subchen

TryLock support on read-write lock for Golang.

github.com/subchen/go-trylock/v2Go 1.13+ No dependencies v2.0.0updated 5y ago

35

channelifyby ddelizia

Transform your function to return channels for easy and powerful parallel processing.

github.com/ddelizia/channelifyGo 1.15+ No dependencies v0.0.1updated 1mo ago

34

execpoolby hexdigest

A pool built around exec.Cmd that spins up a given number of processes in advance and attaches stdin and stdout to them when needed. Very similar to FastCGI or Apache Prefork MPM but works for any command.

github.com/hexdigest/execpoolGo 1.16+ 3 dependenciesv1.0.0updated 5y ago

30

stlby ssgreg

Software transactional locks based on Software Transactional Memory (STM) concurrency control mechanism.

v1.1.0updated 6y ago

30

goscadeby ognick

Minimalistic lifecycle orchestrator for Go components with dependency graphs, startup sequencing, readiness coordination, and graceful shutdown.

github.com/ognick/goscade/v2Go 1.22+ 2 dependenciesv2.5.0updated 1mo ago

24

breakerby kamilsk

Flexible mechanism to make execution flow interruptible.

github.com/kamilsk/breakerGo 1.11+ No dependencies updated 5y ago

21

concurrency-limiterby vivek-ng

Concurrency limiter with support for timeouts, dynamic priority and context cancellation of goroutines.

github.com/vivek-ng/concurrency-limiterGo 1.14+ 1 dependencyv1.3.0updated 7mo ago

18

conexecby ITcathyh

A concurrent toolkit to help execute funcs concurrently in an efficient and safe way. It supports specifying the overall timeout to avoid blocking and uses goroutine pool to improve efficiency.

github.com/ITcathyh/conexecGo 1.13+ 2 dependenciesv1.0.1updated 5mo ago

18

asyncby yaitoo

An asynchronous task package with async/await style for Go.

github.com/yaitoo/asyncGo 1.18+ 1 dependencyv1.0.4updated 1y ago

17

go-tools/multithreadingby nikhilsaraf

Manage a pool of goroutines using this lightweight library with a simple API.

updated 7y ago

17

go-workerpoolby zenthangplus

Inspired from Java Thread Pool, Go WorkerPool aims to control heavy Go Routines.

github.com/zenthangplus/go-workerpoolGo 1.14+ 2 dependenciesv1.0.3updated 4y ago

13

async-jobby lab210-dev

AsyncJob is an asynchronous queue job manager with light code, clear and speed.

github.com/lab210-dev/async-jobGo 1.18+ 1 dependencyv1.1.0updated 4y ago

12

go-accumulatorby nar10z

Solution for accumulation of events and their subsequent processing.

github.com/nar10z/go-accumulator/v2Go 1.26+ 3 dependenciesv2.0.1updated today

11

handsby duanckham

A process controller used to control the execution and return strategies of multiple goroutines.

github.com/duanckham/handsGo 1.23+ No dependencies updated 1y ago

10

anchorby kyuff

Library to manage component lifecycle in microservice architectures.

github.com/kyuff/anchorGo 1.26+ 1 dependencyv1.1.0updated 22d ago

6

autopoolby AshvinBambhaniya

Zero-config, auto-scaling worker pool for Go with priority-aware scheduling.

github.com/AshvinBambhaniya/autopool/v2Go 1.25+ No dependencies v2.0.0updated 3mo ago

6

powerlockby donomii

Named FIFO mutexes with context cancellation, bounded wait queues, watchdog diagnostics, pprof profiles, and Prometheus metrics.

github.com/donomii/powerlockGo 1.23+ 2 dependenciesv0.1.0updated 7d ago

3

oversight

Oversight is a complete implementation of the Erlang supervision trees.

pkg.go.dev

Esc

Type to search every entry. ↑↓ to move, Enter to open.