Skip to content

errors: ensure errors work correctly with wrapped errors

Karthik Nayak requested to merge kn-error-lint into master

Throughout our code, there are instances of error usage which don't work well with wrapped errors. Fix this and add a linter to ensure that this no longer happens.

The different types of changes are:

  1. Usage of errors.Is() instead of err == SomeErr
  2. Usage of errors.As() instead of err, ok := err.(*SomeType)
  3. Usage of errors.As() instead of switch type assertions
  4. Usage of errors.As() instead of switch on an error
  5. Fix issues around multi error wrapping

Finally the addition of errorlint to golangci-lint.

Edited by Karthik Nayak

Merge request reports