Skip to content

Replace github.com/pkg/errors dependency with native error wrapping #14784

@saschagrunert

Description

@saschagrunert

The package github.com/pkg/errors is now in maintenance mode due to the existence of golang native error wrapping. The goal is to do that on a package-by-package basis, where everyone is welcome to contribute.

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) and check that err != nil before
  • convert errors.Wrapf(err, "… %s: %s", foo, bar) to fmt.Errorf("… %s: %s: %w", foo, bar err) and check that err != nil before
  • prefer errors.New if no additional format is required
  • convert errors.Cause to errors.Is checks

Packages to be converted

Metadata

Metadata

Assignees

Labels

locked - please file new issue/PRAssist humans wanting to comment on an old issue or PR with locked comments.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions