Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
9ec4967013 📝 Add Alternatives section to README.md 2025-11-14 15:53:01 -06:00

View file

@ -123,6 +123,19 @@ func main() {
} }
``` ```
## Alternatives
`waiterr` provides a focused approach to goroutine error handling. Here's how it compares to other common Go concurrency primitives and libraries:
* **[`sync.WaitGroup`](https://pkg.go.dev/sync#WaitGroup)**:
* **Differences**: `sync.WaitGroup` is a fundamental primitive for waiting for a collection of goroutines to finish. It does not, however, provide any built-in mechanisms for error propagation or collection. `waiterr` builds upon `sync.WaitGroup` by adding robust error handling, allowing you to collect all errors, or return the first error encountered.
* **[`golang.org/x/sync/errgroup.Group`](https://pkg.go.dev/golang.org/x/sync/errgroup#Group)**:
* **Differences**: `errgroup.Group` is similar to `waiterr` in that it allows you to run goroutines and collect errors. `errgroup.Group` provides a rate-limiting mechanism, to limit the number of goroutines, which `waiterr` does not provide, as it is intended to be more light-weight. Additionally, `waiterr` provides an `Unwrap` method to retrieve all non-nil errors. Finally `waiterr.WaitErr.Wait` returns a combination of all errors, wheres `errgroup.Group.Wait` only returns the first found error.
* **[`gopkg.in/tomb.v2.Tomb`](https://pkg.go.dev/gopkg.in/tomb.v2#Tomb)**:
* **Differences**: `tomb.Tomb` is a more comprehensive library for managing the lifecycle of goroutines, including graceful shutdown, error propagation, and child goroutine management. `waiterr` is a lighter-weight alternative focused specifically on waiting for goroutines and collecting their errors, without the full lifecycle management capabilities of `tomb.Tomb`. If you need advanced goroutine supervision and cleanup, `tomb.Tomb` might be a better fit. For simpler error aggregation and waiting, `waiterr` offers a more streamlined solution.
## Contributing ## Contributing
Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) file for guidelines on contributing to this project, including code style, commit messages, and Git workflow. Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) file for guidelines on contributing to this project, including code style, commit messages, and Git workflow.