-
Notifications
You must be signed in to change notification settings - Fork 592
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
refactor(orc8r): Omit nil-checks for multierror.Append calls #12666
Conversation
Thanks for opening a PR! 💯
Howto
More infoPlease take a moment to read through the Magma project's
If this is your first Magma PR, also consider reading
|
Signed-off-by: Sebastian Wolf <sebastian.wolf@tngtech.com>
b97459c
to
c23375c
Compare
if err != nil { | ||
errs = multierror.Append(errs, errors.Wrapf(err, "collect garbage for table %+v", tableName)) | ||
} | ||
errs = multierror.Append(errs, errors.Wrapf(err, "collect garbage for table %+v", tableName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this nil check might make things more complicated if we intend to get rid of errors.Wrapf later? We will have to reintroduce it then, I suppose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right. Since it is merged now we'll have to change it in the PR that gets rid of Wrapf (#12682); I will arrange that.
Summary
multierror.Append
already handles nil-checks, so checking before calling it is unnecessary, except when the error is formatted with e.g.fmt.Errorf
. This PR follows this discussion.Test Plan
Run unit tests
Additional Information