Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multierr.Every #78

Merged
merged 3 commits into from
Mar 28, 2023
Merged

Support multierr.Every #78

merged 3 commits into from
Mar 28, 2023

Commits on Mar 28, 2023

  1. Support multierr.Every

    This PR introduces a new exported function in the multierr package
    called `Every`, which checks every error within a given error
    against a given target using `errors.Is`, and only returns true if
    all checks return true.
    
    ```go
    err := multierr.Combine(ErrIgnorable, errors.New("great sadness"))
    fmt.Println(multierr.Every(err, ErrIgnorable))
    // output = "false"
    
    err := multierr.Combine(ErrIgnorable, ErrIgnorable)
    fmt.Println(multierr.Every(err, ErrIgnorable)
    // output = "true"
    ```
    
    This also works when the error passed in as the first argument is not a `multiErr`,
    including when it is a go1.20+ error that implements `Unwrap() []error`.
    
    This solves uber-go#66.
    JacobOaks committed Mar 28, 2023
    Configuration menu
    Copy the full SHA
    34f59e5 View commit details
    Browse the repository at this point in the history
  2. Add test for errors.Join

    JacobOaks committed Mar 28, 2023
    Configuration menu
    Copy the full SHA
    5b59a2f View commit details
    Browse the repository at this point in the history
  3. Remove empty lines

    JacobOaks committed Mar 28, 2023
    Configuration menu
    Copy the full SHA
    7b893ed View commit details
    Browse the repository at this point in the history