{"id":20543540,"url":"https://github.com/bavix/gonce","last_synced_at":"2026-04-21T07:31:38.079Z","repository":{"id":84370341,"uuid":"352019006","full_name":"bavix/gonce","owner":"bavix","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-20T18:14:51.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-28T06:27:03.954Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bavix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2021-03-27T08:18:50.000Z","updated_at":"2024-02-20T18:14:51.000Z","dependencies_parsed_at":"2024-04-19T05:46:03.573Z","dependency_job_id":null,"html_url":"https://github.com/bavix/gonce","commit_stats":{"total_commits":2,"total_committers":2,"mean_commits":1.0,"dds":0.5,"last_synced_commit":"47eacf605fd15d18fc0cb85968e5601a965181e0"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/bavix/gonce","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bavix%2Fgonce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bavix%2Fgonce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bavix%2Fgonce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bavix%2Fgonce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bavix","download_url":"https://codeload.github.com/bavix/gonce/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bavix%2Fgonce/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32082087,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T06:27:27.065Z","status":"ssl_error","status_checked_at":"2026-04-21T06:27:21.250Z","response_time":128,"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":[],"created_at":"2024-11-16T01:38:45.500Z","updated_at":"2026-04-21T07:31:38.059Z","avatar_url":"https://github.com/bavix.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"gonce - mini package implementing singleton.\n\n* **Vendor**: bavix\n* **Package**: gonce\n\n### Installation\n\n```bash\ngo get github.com/bavix/gonce\n```\n\n### Get started\n\nlet's make a simple singleton object for telegrams\n\n```go\npackage telegram\n\nimport (\n\t\"github.com/bavix/gonce\"\n\ttgbotapi \"github.com/go-telegram-bot-api/telegram-bot-api\"\n)\n\nvar instance *tgbotapi.BotAPI\nvar once gonce.Once\n\nfunc GetInstance(token string) *tgbotapi.BotAPI {\n\tonce.Do(func() {\n\t\tbotApi, err := tgbotapi.NewBotAPI(token)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tinstance = botApi\n\t})\n\n\treturn instance\n}\n```\n\nPS, don't forget, singleton is an anti-pattern. It should be used extremely rarely.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbavix%2Fgonce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbavix%2Fgonce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbavix%2Fgonce/lists"}