Skip to content

Multierror: join errors at the end#132

Merged
camdencheek merged 1 commit into
mainfrom
cc/join-err-slice
Jan 8, 2024
Merged

Multierror: join errors at the end#132
camdencheek merged 1 commit into
mainfrom
cc/join-err-slice

Conversation

@camdencheek

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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
@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