{"id":15658727,"url":"https://github.com/magicdawn/go-co","last_synced_at":"2025-05-05T16:45:18.744Z","repository":{"id":31761266,"uuid":"35327473","full_name":"magicdawn/go-co","owner":"magicdawn","description":"coroutine , async/await for golang","archived":false,"fork":false,"pushed_at":"2020-03-06T14:44:38.000Z","size":23,"stargazers_count":21,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T22:32:10.562Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magicdawn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-09T12:18:10.000Z","updated_at":"2025-01-05T18:13:34.000Z","dependencies_parsed_at":"2022-09-13T08:20:57.573Z","dependency_job_id":null,"html_url":"https://github.com/magicdawn/go-co","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdawn%2Fgo-co","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdawn%2Fgo-co/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdawn%2Fgo-co/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdawn%2Fgo-co/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magicdawn","download_url":"https://codeload.github.com/magicdawn/go-co/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252535550,"owners_count":21763975,"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","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":"2024-10-03T13:13:45.755Z","updated_at":"2025-05-05T16:45:18.717Z","avatar_url":"https://github.com/magicdawn.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-co\n\n[![GoDoc](https://godoc.org/github.com/magicdawn/go-co?status.svg)](https://godoc.org/github.com/magicdawn/go-co)\n\ncoroutine , async/await for golang\n\n## Goals\n\nto simulate\n- yield/Promise in node.js, [co](https://github.com/tj/co)\n- async/await/Task in C#\n\n*checkout blog http://magicdawn.ml/2015/01/10/generator-and-promise/*\n\n## Install\nwith [glide](https://github.com/Masterminds/glide)\n\n```sh\n$ glide get github.com/magicdawn/go-co\n```\n\n## API\n\n### `co`\n```go\nimport \"github.com/magicdawn/go-co\"\n```\n\n- co.Task : similar to Task in .NET,stands for a samll piece of work\n- co.Await: await a Task\n\n    ```go\n    result,err := co.Await(task)\n    ```\n- co.Async: make a Task\n    ```go\n    func sleep() *co.Task{\n    \treturn co.Async(func() interface{}{\n        \ttime.sleep(time.Seconds * 10)\n            return nil\n        })\n    }\n    ```\n\n    here is a Task will need 10 seconds\n\n### `coutil`\n\n- `coutil.Each` : like `Promise.each`\n- `coutil.Map` : like `Promise.map` with concurrency support\n\n*more checkout demo/ directory*\n\n## CHANGELOG\n[CHANGELOG.md](CHANGELOG.md)\n\n## License\nthe MIT license (magicdawn@qq.com)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagicdawn%2Fgo-co","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagicdawn%2Fgo-co","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagicdawn%2Fgo-co/lists"}