{"id":51563036,"url":"https://github.com/firetiger-oss/concurrent","last_synced_at":"2026-07-10T12:02:32.049Z","repository":{"id":355664073,"uuid":"1176333148","full_name":"firetiger-oss/concurrent","owner":"firetiger-oss","description":"A modern take on structured concurrency in Go","archived":false,"fork":false,"pushed_at":"2026-03-09T16:34:41.000Z","size":45,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-04T19:05:58.395Z","etag":null,"topics":["channel","concurrency","golang","goroutine","iterator","queue","streaming","structured-concurrency","synchronization","type-safety"],"latest_commit_sha":null,"homepage":"https://firetiger.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/firetiger-oss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-08T23:04:03.000Z","updated_at":"2026-04-28T06:49:54.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/firetiger-oss/concurrent","commit_stats":null,"previous_names":["firetiger-oss/concurrent"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/firetiger-oss/concurrent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firetiger-oss%2Fconcurrent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firetiger-oss%2Fconcurrent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firetiger-oss%2Fconcurrent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firetiger-oss%2Fconcurrent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/firetiger-oss","download_url":"https://codeload.github.com/firetiger-oss/concurrent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firetiger-oss%2Fconcurrent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35330738,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-10T02:00:06.465Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["channel","concurrency","golang","goroutine","iterator","queue","streaming","structured-concurrency","synchronization","type-safety"],"created_at":"2026-07-10T12:02:31.151Z","updated_at":"2026-07-10T12:02:32.042Z","avatar_url":"https://github.com/firetiger-oss.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# concurrent [![CI](https://github.com/firetiger-oss/concurrent/actions/workflows/ci.yml/badge.svg)](https://github.com/firetiger-oss/concurrent/actions/workflows/ci.yml) [![Go Reference](https://pkg.go.dev/badge/github.com/firetiger-oss/concurrent.svg)](https://pkg.go.dev/github.com/firetiger-oss/concurrent)\n\nA modern take on structured concurrency in Go.\n\n## Motivation\n\nGo provides excellent low-level concurrency primitives (goroutines,\nchannels, sync package), but composing them into higher-level patterns such as\nfan-out pipelines, bounded worker pools, ordered result collection—requires\nrepetitive boilerplate and careful coordination. Furthermore, applying limits to\navoid unbounded resource utilization due to spawning too many goroutines is a\ntedious task that often gets overlooked and only breaks when the code is shipped\nto production. Spawning goroutines also introduces reliability challenges, such\nas dealing with panics unwinding to the start of a goroutines and terminating the\nentire program, which is rarely the desirable behavior in server applications that\nGo is often used for.\n\nThe `concurrent` package provides a small set of composable building blocks\nthat handle goroutine lifecycle, ordering, error handling, and panic propagation.\nAll concurrent operations respect a context-based concurrency limit, making it\neasy to control resource usage across an entire call tree.\n\nResults are returned as `iter.Seq` / `iter.Seq2` iterators, so they compose\nnaturally with the standard library and range loops.\n\n## Usage\n\n### [concurrent.WithLimit](https://pkg.go.dev/github.com/firetiger-oss/concurrent#WithLimit)\n\nControl parallelism via context. The limit propagates through the call tree and\ncan only be decreased, never increased.\n\n```go\nctx := concurrent.WithLimit(ctx, 4) // at most 4 concurrent operations\n```\n\n### [concurrent.Pipeline](https://pkg.go.dev/github.com/firetiger-oss/concurrent#Pipeline)\n\nThe core primitive — use when you have an `iter.Seq2` stream and a transform\nfunction. All other APIs are convenience wrappers built on top of Pipeline.\n\n```go\nresults := concurrent.Pipeline(ctx, inputSeq, func(ctx context.Context, in T) (Out, error) {\n    ...\n})\n\nfor out, err := range results {\n    // results arrive in input order\n    ...\n}\n```\n\n### [concurrent.Run](https://pkg.go.dev/github.com/firetiger-oss/concurrent#Run) / [concurrent.RunTasks](https://pkg.go.dev/github.com/firetiger-oss/concurrent#RunTasks)\n\nConvenience wrappers for when your input is a `[]T` slice. `Run` collects\nresults as an iterator, `RunTasks` for functions that have side-effects but\ndon't return any errors.\n\n```go\nfor result, err := range concurrent.Run(ctx, urls,\n    func(ctx context.Context, url string) (Result, error) {\n        ...\n    },\n) {\n    ...\n}\n```\n```go\nerr := concurrent.RunTasks(ctx, items, func(ctx context.Context, item Item) error {\n    ...\n})\n```\n\n### [concurrent.Exec](https://pkg.go.dev/github.com/firetiger-oss/concurrent#Exec) / [concurrent.Query](https://pkg.go.dev/github.com/firetiger-oss/concurrent#Query)\n\nUse when you have a small, fixed set of independent functions rather than a\nhomogeneous slice. `Exec` for error-only tasks, `Query` when each task returns\na value.\n\n```go\nfor err := range concurrent.Exec(ctx, task1, task2, task3) {\n    if err != nil {\n        ...\n    }\n}\n```\n```go\nfor result, err := range concurrent.Query(ctx, query1, query2) {\n    ...\n}\n```\n\n### [concurrent.Queue](https://pkg.go.dev/github.com/firetiger-oss/concurrent#Queue) / [concurrent.Process](https://pkg.go.dev/github.com/firetiger-oss/concurrent#Process)\n\nUse for producer-consumer patterns where jobs arrive dynamically over time\nrather than being known upfront.\n\n```go\nq := concurrent.NewQueue[Result]()\n\n// Producer goroutine\ngo func() {\n    for job := range jobs {\n        q.Push(func(ctx context.Context, yield func(Result, error) bool) {\n            yield(process(ctx, job))\n        })\n    }\n}()\n\n// Consumer — blocks until queue.Done() is called and all jobs are processed\nfor result, err := range concurrent.Process(ctx, q) {\n    // ...\n}\n```\n\n## Contributing\n\nContributions are welcome! To get started:\n\n1. Ensure you have Go 1.25+ installed\n2. Run `go test ./...` to verify tests pass\n\nPlease report bugs and feature requests via [GitHub Issues](https://github.com/firetiger-oss/concurrent/issues).\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffiretiger-oss%2Fconcurrent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffiretiger-oss%2Fconcurrent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffiretiger-oss%2Fconcurrent/lists"}