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

Chore: remove superfluous errors.Cause() usage in pkg/storage #7212

Merged
merged 1 commit into from
Jan 25, 2024

Conversation

pracucci
Copy link
Collaborator

What this PR does

In this PR I'm removing superfluous errors.Cause() usage in pkg/storage. This usage of errors.Is(errors.Cause(), ...) was introduced in #3288 when removing Thanos dependency.

The reason why errors.Cause() is superfluous is because errors.Is() already navigates the chain of wrapped errors, so we don't have to look at the Cause() of an error. I've checked all places where these errors are returned, and they're all correctly wrapped with errors.Wrap() (so errors.Is() is enough). In addition, for the errors returned by ReadMarker(), in other places in the code we just check the same errors using only errors.Is(), another signal that errors.Cause() is not needed.

Note: this PR is part of a work I'm doing to completely remove errors.Cause() from Mimir.

Which issue(s) this PR fixes or relates to

N/A

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features.

Signed-off-by: Marco Pracucci <marco@pracucci.com>
@pracucci pracucci marked this pull request as ready for review January 25, 2024 10:42
@pracucci pracucci requested a review from a team as a code owner January 25, 2024 10:42
@pracucci pracucci mentioned this pull request Jan 25, 2024
4 tasks
@pracucci pracucci merged commit d609d3e into main Jan 25, 2024
28 checks passed
@pracucci pracucci deleted the remove-errors-cause-from-pkg-storage branch January 25, 2024 13:07
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.

2 participants