{"id":39078709,"url":"https://github.com/41north/async.go","last_synced_at":"2026-01-17T18:28:37.968Z","repository":{"id":58711922,"uuid":"533019141","full_name":"41north/async.go","owner":"41north","description":"A collection of utilities for async code in Go.","archived":false,"fork":false,"pushed_at":"2022-10-02T09:01:59.000Z","size":37,"stargazers_count":28,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-20T21:14:42.549Z","etag":null,"topics":["async","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/41north.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":"2022-09-05T18:39:27.000Z","updated_at":"2024-04-22T17:40:52.000Z","dependencies_parsed_at":"2022-09-06T16:21:28.334Z","dependency_job_id":null,"html_url":"https://github.com/41north/async.go","commit_stats":null,"previous_names":["41north/go-async"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/41north/async.go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/41north%2Fasync.go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/41north%2Fasync.go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/41north%2Fasync.go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/41north%2Fasync.go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/41north","download_url":"https://codeload.github.com/41north/async.go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/41north%2Fasync.go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28515567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T18:28:00.501Z","status":"ssl_error","status_checked_at":"2026-01-17T18:28:00.150Z","response_time":85,"last_error":"SSL_read: 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":["async","go","golang"],"created_at":"2026-01-17T18:28:37.820Z","updated_at":"2026-01-17T18:28:37.937Z","avatar_url":"https://github.com/41north.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# async.go\n\n![Build](https://github.com/41north/async.go/actions/workflows/ci.yml/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/41north/async.go/badge.svg)](https://coveralls.io/github/41north/async.go)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\nStatus: _EXPERIMENTAL_\n\nThis library is primarily intended as a directed learning exercise and eventual collection of utilities and patterns\nfor working asynchronously in Go.\n\n## Documentation\n\n[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/41north/async.go)\n\nFull `go doc` style documentation for the project can be viewed online without\ninstalling this package by using the excellent GoDoc site here:\nhttp://godoc.org/github.com/41north/async.go\n\nYou can also view the documentation locally once the package is installed with\nthe `godoc` tool by running `godoc -http=\":6060\"` and pointing your browser to\nhttp://localhost:6060/pkg/github.com/41north/async.go\n\n## Installation\n\n```bash\n$ go get -u github.com/41north/async.go\n```\n\nAdd this import line to the file you're working in:\n\n```Go\nimport \"github.com/41north/async.go\"\n```\n\n## Quick Start\n\n### Future\n\nA basic example:\n\n```Go\n// create a string future\nf := NewFuture[string]()\n\n// create a consumer channel\nch := f.Get()\ngo func() {\n\tprintln(fmt.Sprintf(\"Value: %s\", \u003c-ch))\n}()\n\n// set the value\nf.Set(\"hello\")\n```\n\n### Counting Semaphore\n\nA basic example:\n\n```go\n// we create an input and output channel for work needing to be done\ninCh := make(chan string, 128)\noutCh := make(chan int, 128)\n\n// we want a max of 10 in-flight processes\ns := NewCountingSemaphore(10)\n\n// we create more workers than tokens available\nfor i := 0; i \u003c 100; i++ {\n\tgo func() {\n\t\tfor {\n\t\t\t// acquire a token, waiting until one is available\n\t\t\ts.Acquire(1)\n\n\t\t\t// consume from the input channel\n\t\t\tv, ok := \u003c-inCh\n\t\t\tif !ok {\n\t\t\t\t// channel was closed\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// do some work and produce an output value\n\t\t\toutCh \u003c- len(v)\n\n\t\t\t// you need to be careful about releasing, if possible perform it with defer\n\t\t\ts.Release(1)\n\t\t}\n\t}()\n}\n\n// generate some work and put it into the work queue\n// ...\n// ...\n```\n\nThere are more examples available in the go doc.\n\n## License\n\nGo-async is licensed under the [Apache 2.0 License](LICENSE)\n\n## Contact\n\nIf you want to get in touch drop us an email at [hello@41north.dev](mailto:hello@41north.dev)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F41north%2Fasync.go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F41north%2Fasync.go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F41north%2Fasync.go/lists"}