Skip to content

dev: replace pkg/errors with native error wrapping #3604

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

Merged
merged 2 commits into from
Feb 22, 2023

Conversation

alexandear
Copy link
Member

@alexandear alexandear commented Feb 17, 2023

The package github.com/pkg/errors is archived from Dec 1, 2021 due to the existence of Go native error wrapping.

Changes in internal folder are skipped for now.

Conversion rules

  • use the errors import in favor of github.com/pkg/errors
  • convert errors.Errorf to fmt.Errorf
  • convert errors.Wrap(err, "…") to fmt.Errorf("…: %w", err)
  • convert errors.Wrapf(err, "… %s: %s", foo, bar) to fmt.Errorf("… %s: %s: %w", foo, bar err)
  • prefer errors.New if no additional format is required
  • convert errors.Cause to errors.As or errors.Unwrap

@alexandear alexandear marked this pull request as ready for review February 17, 2023 13:09
@ldez ldez added the topic: cleanup Related to code, process, or doc cleanup label Feb 17, 2023
@ldez ldez self-requested a review February 17, 2023 13:12
alexandear and others added 2 commits February 21, 2023 22:50
Replace deprecated dependency github.com/pkg/errors with native error
wrapping.
Packages in internal are skipped for now.
@ldez ldez force-pushed the dev-replace-pkg-errors branch from bd35379 to 19aa7d0 Compare February 21, 2023 21:50
Copy link
Member

@ldez ldez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ldez ldez merged commit b673c5c into golangci:master Feb 22, 2023
@alexandear alexandear deleted the dev-replace-pkg-errors branch February 22, 2023 08:08
SeigeC pushed a commit to SeigeC/golangci-lint that referenced this pull request Apr 4, 2023
@ldez ldez added this to the v1.52 milestone Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: cleanup Related to code, process, or doc cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants