{"id":20271899,"url":"https://github.com/point-c/simplewg","last_synced_at":"2026-06-04T02:31:23.365Z","repository":{"id":216599777,"uuid":"741700965","full_name":"point-c/simplewg","owner":"point-c","description":"Simple waitgroup implementation.","archived":false,"fork":false,"pushed_at":"2024-01-20T21:42:11.000Z","size":353,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-14T05:50:40.882Z","etag":null,"topics":["golang","golang-library","waitgroup"],"latest_commit_sha":null,"homepage":"https://point-c.github.io/simplewg/","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/point-c.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-10T23:45:31.000Z","updated_at":"2024-01-27T07:34:06.000Z","dependencies_parsed_at":"2024-06-21T19:23:40.884Z","dependency_job_id":"f2bbde22-f91f-4b38-bab8-bdb3c92f3686","html_url":"https://github.com/point-c/simplewg","commit_stats":null,"previous_names":["point-c/simplewg"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/point-c%2Fsimplewg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/point-c%2Fsimplewg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/point-c%2Fsimplewg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/point-c%2Fsimplewg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/point-c","download_url":"https://codeload.github.com/point-c/simplewg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241758963,"owners_count":20015251,"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":["golang","golang-library","waitgroup"],"created_at":"2024-11-14T12:39:54.285Z","updated_at":"2026-06-04T02:31:23.315Z","avatar_url":"https://github.com/point-c.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SimpleWG\n\n[![Go Reference](https://img.shields.io/badge/godoc-reference-%23007d9c.svg)](https://point-c.github.io/simplewg)\n\n## Overview\nSimpleWG is a Go package that provides a simplified wrapper around the standard `sync.WaitGroup`. It is designed to make working with goroutines more straightforward by automating the handling of `sync.WaitGroup.Add` and `sync.WaitGroup.Done`. This package is ideal for scenarios where you need to manage the lifecycle of multiple goroutines easily.\n\n## Installation\n\nTo use SimpleWG in your Go project, install it using `go get`:\n\n```bash\ngo get github.com/point-c/simplewg\n```\n\n## Usage\n\n### Creating a New WaitGroup\n\nCreate a new instance of `Wg`:\n\n```go\nvar wg simplewg.Wg\n```\n\n### Running Goroutines\n\nUse the `Go` method to run functions in separate goroutines. This method automatically handles the addition of goroutines to the waitgroup:\n\n```go\nwg.Go(func() {\n    // Your goroutine logic here\n})\n```\n\n### Waiting for Goroutines to Complete\n\nTo wait for all goroutines to complete, use the `Wait` method:\n\n```go\nwg.Wait()\n```\n\n### Wait for Goroutines to Complete with Timeout\n\no wait for goroutines to complete while also considering a timeout or other event, use the Done method in combination with a select statement.\n\n```go\nvar wg simplewg.Wg\n// Use Go to start goroutines...\nctx, cancel := context.WithTimeout(context.Background(), time.Minute)\ndefer cancel()\nselect {\ncase \u003c-ctx.Done():\ncase \u003c-wg.Done():\n}\n```\n\n## Example\n\nHere's a simple example demonstrating the usage of the SimpleWG package:\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/yourusername/simplewg\"\n)\n\nfunc main() {\n    var wg simplewg.Wg\n\n    wg.Go(func() {\n        fmt.Println(\"Hello from goroutine 1\")\n    })\n\n    wg.Go(func() {\n        fmt.Println(\"Hello from goroutine 2\")\n    })\n\n    wg.Wait()\n    // or\n    select {\n    case \u003c-wg.Done():\n    }\n\t\n    fmt.Println(\"All goroutines completed\")\n}\n```\n\n## Testing\n\nThe package includes tests that demonstrate its functionality. Use Go's testing tools to run the tests:\n\n```bash\ngo test\n```\n\n## Godocs\n\nTo regenerate godocs:\n\n```bash\ngo generate -tags docs ./...\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoint-c%2Fsimplewg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpoint-c%2Fsimplewg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoint-c%2Fsimplewg/lists"}