In the effort to return better errors we need to make sure that we are wrapping errors properly. One part of it is that we wrap errors properly. This means using the correct format when wrapping errors fmt.Errorf("something else: %w", err). The other par is that we do not discard upstream errors when returning an error.
I have looked around and have not immediately found a way for a linter to check if the parent error has been discarded. It would be nice to have this but may not be possible.
In the effort to return better errors we need to make sure that we are wrapping errors properly. One part of it is that we wrap errors properly. This means using the correct format when wrapping errors
fmt.Errorf("something else: %w", err)
. The other par is that we do not discard upstream errors when returning an error.Errorlint should check for the correct format when enabled. It can miss certain cases which is why some manual verification needs to be done. https://golangci-lint.run/usage/linters/#errorlint