{"id":31822931,"url":"https://github.com/devfans/cogroup","last_synced_at":"2025-10-11T14:20:39.693Z","repository":{"id":57563971,"uuid":"334157570","full_name":"devfans/cogroup","owner":"devfans","description":"Golang coroutine group","archived":false,"fork":false,"pushed_at":"2023-02-25T02:35:17.000Z","size":65,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-07-27T22:03:05.512Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devfans.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}},"created_at":"2021-01-29T13:43:58.000Z","updated_at":"2023-02-13T16:58:28.000Z","dependencies_parsed_at":"2022-09-16T13:30:23.271Z","dependency_job_id":null,"html_url":"https://github.com/devfans/cogroup","commit_stats":null,"previous_names":[],"tags_count":9,"template":null,"template_full_name":null,"purl":"pkg:github/devfans/cogroup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devfans%2Fcogroup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devfans%2Fcogroup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devfans%2Fcogroup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devfans%2Fcogroup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devfans","download_url":"https://codeload.github.com/devfans/cogroup/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devfans%2Fcogroup/sbom","scorecard":{"id":337417,"data":{"date":"2025-08-11","repo":{"name":"github.com/devfans/cogroup","commit":"a502f0ac8170d40d913fb2e2fa341d97f787b9cb"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: GNU General Public License v3.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T05:03:05.913Z","repository_id":57563971,"created_at":"2025-08-18T05:03:05.914Z","updated_at":"2025-08-18T05:03:05.914Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279007496,"owners_count":26084313,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"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":[],"created_at":"2025-10-11T14:20:33.442Z","updated_at":"2025-10-11T14:20:39.688Z","avatar_url":"https://github.com/devfans.png","language":"Go","readme":"# cogroup\nGolang coroutine group\n\n[![Build Status](https://travis-ci.org/devfans/cogroup.svg?branch=master)](https://travis-ci.org/devfans/cogroup)\n[![Go Report Card](https://goreportcard.com/badge/github.com/devfans/cogroup)](https://goreportcard.com/report/github.com/devfans/cogroup)\n[![GoDoc](https://godoc.org/github.com/devfans/cogroup?status.svg)](https://godoc.org/github.com/devfans/cogroup) [![Join the chat at https://gitter.im/devfans/cogroup](https://badges.gitter.im/devfans/cogroup.svg)](https://gitter.im/devfans/cogroup?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nPackage cogroup provides an elegant goroutine group with context controls. It's designed to meet the following requirements.\n\n- Tasks can be executed without order\n- Group `wait` command will close the write access to the task queue\n- Upstream context can cancel/stop the execution of the tasks\n- When the context is canceled, the tasks in queue will be no longer consumed\n- Only spawn specified number of goroutines to consume the task queue\n- Panic recover for a single task execution\n- Custom worker with upstream context and worker id provided.\n- `Wait` will block until tasks are finished or canceled, and return with the queue length\n\n### Usage\n\nStart a group and wait till all the tasks are finished.\n\n```\nimport  (\n  \"context\"\n  \"time\"\n\n  \"github.com/devfans/cogroup\"\n)\n\nfunc main() {\n  f := func(context.Context) error {\n    \u003c-time.After(time.Second)\n    return nil\n  }\n\n  g := cogroup.Start(context.Background(), 2, 10, false)\n  for i := 0; i \u003c 10; i++ {\n    g.Add(f)\n  }\n  g.Wait()\n}\n\n```\n\nStart a group and cancel it later.\n\n```\nimport  (\n  \"context\"\n  \"time\"\n\n  \"github.com/devfans/cogroup\"\n)\n\nfunc main() {\n  f := func(ctx context.Context) error {\n    \u003c-time.After(time.Second)\n    workerID := cogroup.GetWorkerID(ctx)\n    println(workerID, \" did one task\")\n    return nil\n  }\n\n  ctx, cancel := context.WithCancel(context.Background())\n  g := cogroup.Start(ctx, 2, 10, false)\n  go func() {\n    \u003c-time.After(1 * time.Second)\n    cancel()\n  }()\n\n  for i := 0; i \u003c 100; i++ {\n    g.Add(f)\n  }\n  println(\"Tasks left:\", g.Wait())\n}\n\n```\n\nStart a group with custom worker\n\n```\nimport  (\n  \"context\"\n  \"time\"\n\n  \"github.com/devfans/cogroup\"\n)\n\nfunc main() {\n  f := func(context.Context) error {\n    \u003c-time.After(time.Second)\n    return nil\n  }\n\n  g := cogroup.New(context.Background(), 2, 10, false)\n  g.StartWithWorker(func(ctx context.Context, i int, f func(context.Context) error {\n    println(\"Worker is running with id\", i)\n    f(ctx)\n  }))\n  for i := 0; i \u003c 10; i++ {\n    g.Add(f)\n  }\n  g.Wait()\n}\n\n\n```\n\n\n### Misc\n\nBlog：https://blog.devfans.io/create-a-golang-coroutine-group/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevfans%2Fcogroup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevfans%2Fcogroup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevfans%2Fcogroup/lists"}