errors: ensure errors work correctly with wrapped errors
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:
- Usage of
errors.Is()
instead oferr == SomeErr
- Usage of
errors.As()
instead oferr, ok := err.(*SomeType)
- Usage of
errors.As()
instead of switch type assertions - Usage of
errors.As()
instead of switch on an error - Fix issues around multi error wrapping
Finally the addition of errorlint
to golangci-lint
.
Edited by Karthik Nayak