{"id":19196406,"url":"https://github.com/nkcmr/async","last_synced_at":"2025-08-21T00:14:03.474Z","repository":{"id":77063686,"uuid":"429528493","full_name":"nkcmr/async","owner":"nkcmr","description":"experimental promises in go1.18 with generics","archived":false,"fork":false,"pushed_at":"2021-11-28T14:26:31.000Z","size":5,"stargazers_count":62,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-08-13T07:46:56.078Z","etag":null,"topics":["async","async-await","generics","go","golang"],"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/nkcmr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","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":"2021-11-18T17:56:38.000Z","updated_at":"2025-03-25T21:26:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"dfc0ed3f-8701-48ca-8a71-7a45ed0acde6","html_url":"https://github.com/nkcmr/async","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/nkcmr/async","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nkcmr%2Fasync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nkcmr%2Fasync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nkcmr%2Fasync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nkcmr%2Fasync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nkcmr","download_url":"https://codeload.github.com/nkcmr/async/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nkcmr%2Fasync/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271406123,"owners_count":24753918,"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-08-20T02:00:09.606Z","response_time":69,"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":["async","async-await","generics","go","golang"],"created_at":"2024-11-09T12:13:37.408Z","updated_at":"2025-08-21T00:14:03.446Z","avatar_url":"https://github.com/nkcmr.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# async go\n\na prototype of \"promises\" in go1.18.\n\n**note**: this is just an experiment used to test alternate patterns for dealing with asynchronous code in go. i would not recommend adopting this pattern blindly (especially in production environments) until there is a broader consensus in the go community about this. it might turn out that through some hands-on experience that go's native channels/goroutines are a good enough abstraction and there are no gains to be made from building on top of them.\n\n## install\n\nshould be just a regular package:\n\n```\ngo get -u -v code.nkcmr.net/async@latest\n```\n\n## usage\n\npromises abstract away a lot of details about how asynchronous work is handled.\nso if you need for something to be async, simply us a promise:\n\n```go\nimport (\n    \"context\"\n    \"code.nkcmr.net/async\"\n)\n\ntype MyData struct {/* ... */}\n\nfunc AsyncFetchData(ctx context.Context, dataID int64) async.Promise[MyData] {\n    return async.NewPromise(func() (MyData, error) {\n        /* ... */\n        return myDataFromRemoteServer, nil\n    })\n}\n\nfunc DealWithData(ctx context.Context) {\n    myDataPromise := AsyncFetchData(ctx, 451)\n    // do other stuff while operation is not settled\n    // once your ready to wait for data:\n    myData, err := myDataPromise.Await(ctx)\n    if err != nil {/* ... */}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnkcmr%2Fasync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnkcmr%2Fasync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnkcmr%2Fasync/lists"}