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

Use Go 1.20 errors.Join instead of go.uber.org/multierr #8210

Open
mx-psi opened this issue Aug 9, 2023 · 3 comments
Open

Use Go 1.20 errors.Join instead of go.uber.org/multierr #8210

mx-psi opened this issue Aug 9, 2023 · 3 comments

Comments

@mx-psi
Copy link
Member

mx-psi commented Aug 9, 2023

Go 1.20 includes new builtin error joining support that can replace the usage of go.uber.org/multierr. We should switch to using these and ban the usage of go.uber.org/multierr via depguard (same as this).

This is blocked by #8207

@shivanshuraj1333
Copy link
Member

@mx-psi kindly assign this one as well

@bogdandrutu
Copy link
Member

@mx-psi can you document why we stopped this effort until better understand the performance issue.

@mx-psi mx-psi added on hold and removed good first issue Good for newcomers easy Complexity: Easy labels Jan 30, 2024
@mx-psi
Copy link
Member Author

mx-psi commented Jan 30, 2024

I removed the good first issue and easy labels and added on hold instead.

The 'easy' way to change the code to use errors.Join means creating a slice of errors, which in the common case will all be nil, and then joining that slice. multierr.Append instead avoids this by checking if the error is nil before adding to the internal slice, which is more performant.

We can still use errors.Join and avoid this by checking that the errors are not nil before appending to the slice, but it leads to more verbose code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants