{"id":42019727,"url":"https://github.com/huysamen/scatter","last_synced_at":"2026-01-26T03:33:20.457Z","repository":{"id":65855057,"uuid":"577687967","full_name":"huysamen/scatter","owner":"huysamen","description":"A simple library for running multiple jobs concurrently using goroutines.","archived":false,"fork":false,"pushed_at":"2023-04-21T07:44:07.000Z","size":7,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2023-06-27T21:36:10.672Z","etag":null,"topics":["concurrency","go","golang","goroutine-pool","goroutines"],"latest_commit_sha":null,"homepage":"","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/huysamen.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}},"created_at":"2022-12-13T09:53:23.000Z","updated_at":"2024-06-19T11:13:44.838Z","dependencies_parsed_at":"2024-06-19T11:13:41.567Z","dependency_job_id":null,"html_url":"https://github.com/huysamen/scatter","commit_stats":null,"previous_names":[],"tags_count":2,"template":null,"template_full_name":null,"purl":"pkg:github/huysamen/scatter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huysamen%2Fscatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huysamen%2Fscatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huysamen%2Fscatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huysamen%2Fscatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huysamen","download_url":"https://codeload.github.com/huysamen/scatter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huysamen%2Fscatter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28765923,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T03:19:35.311Z","status":"ssl_error","status_checked_at":"2026-01-26T03:19:13.815Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["concurrency","go","golang","goroutine-pool","goroutines"],"created_at":"2026-01-26T03:33:20.018Z","updated_at":"2026-01-26T03:33:20.452Z","avatar_url":"https://github.com/huysamen.png","language":"Go","readme":"# Scatter\nSimple library for running multiple jobs concurrently using goroutines.\n\n### Installation\n\nTo install the Scatter library, use the following command:\n\n```sh\ngo get github.com/huysamen/scatter\n```\n\n### Usage\n\nThe Scatter library provides a simple API for running multiple jobs concurrently using goroutines. It provides\nsupport for running functions that only take input (and produces no output), as well as functions that take\ninput and produce output.\n\nThe library also provides support for dealing with contexts with cancellation, deadlines and timeouts.\n\nLastly, as this library makes use of goroutines, it also handles panic recovery and will return any panics as\nerrors.\n\n\n### Examples\n\nFor complete examples, see the [test](scatter_test.go) file.\n\nHere is an example of how to use the Scatter library to run multiple jobs concurrently, whilst\ndealing with context cancellation.\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\n\t\n\t\"github.com/huysamen/scatter\"\n)\n\ntype in struct {\n\ti int\n}\n\ntype out struct {\n\ti int\n\to int\n}\n\nfunc main() {\n\tvar jobs []in\n\tfor i := 0; i \u003c 100; i++ {\n\t\tjobs = append(jobs, in{i})\n\t}\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tgo func() {\n\t\ttime.Sleep(200 * time.Millisecond)\n\t\tcancel()\n\t}()\n\n\tresults, errs := scatter.RunIOCtx[in, out](ctx, 8, jobs, func(job in) (out, error) {\n\t\ttime.Sleep(100 * time.Millisecond)\n\t\t\n\t\treturn out{i: job.i, o: job.i * 2}, nil\n\t})\n\n\tfmt.Println(\"Results:\", results)\n\tfmt.Println(\"Errors:\", errs)\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuysamen%2Fscatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuysamen%2Fscatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuysamen%2Fscatter/lists"}