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

Multierror: join errors at the end #132

Merged
merged 1 commit into from
Jan 8, 2024
Merged

Multierror: join errors at the end #132

merged 1 commit into from
Jan 8, 2024

Conversation

camdencheek
Copy link
Member

This fixes MapErr so that it does not create recursive joinErrors. By repeatedly calling errors.Join(, we create a nested set of joinErrors rather than a single, flat joinError. Then, when Error() is called, it allocates a new string for each nested error because joinError calls Error() recursively on each of its children.

Instead, this PR updates MapErr to just collect a slice of errors and return the flat joined error.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (30a99cd) 99.31% compared to head (c6e6d74) 99.31%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #132   +/-   ##
=======================================
  Coverage   99.31%   99.31%           
=======================================
  Files          12       12           
  Lines         441      441           
=======================================
  Hits          438      438           
  Misses          3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@camdencheek camdencheek merged commit 4afefce into main Jan 8, 2024
2 checks passed
@camdencheek camdencheek deleted the cc/join-err-slice branch January 8, 2024 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants