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

Add a helper for formatting multiple errors #2365

Merged
merged 4 commits into from
Apr 5, 2024
Merged

Commits on Apr 3, 2024

  1. Introduce internal/multierr.Format

    It's sad that this is even necessary, but using fmt.Errorf with an []error
    is way too inconvenient without a helper.
    
    Only adds a new function, should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Apr 3, 2024
    Configuration menu
    Copy the full SHA
    63d82b6 View commit details
    Browse the repository at this point in the history
  2. Use multierr.Format where possible

    This may make errors visible to errors.As/errors.Is
    
    This commit, in general, attempts not to change the formatting;
    only in newShortNameAliasCache, the order of the errors is no longer
    reversed.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Apr 3, 2024
    Configuration menu
    Copy the full SHA
    0889f39 View commit details
    Browse the repository at this point in the history
  3. Improve the error formatting in newShortNameAliasCache

    Don't treat the first error specially.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Apr 3, 2024
    Configuration menu
    Copy the full SHA
    70e9530 View commit details
    Browse the repository at this point in the history
  4. Remove the (direct) dependency on github.com/hashicorp/go-multierror

    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Apr 3, 2024
    Configuration menu
    Copy the full SHA
    f13e5cd View commit details
    Browse the repository at this point in the history