Skip to content
public-library›Rules›Go›Expose error identity only for contract errors

Expose error identity only for contract errors

Let callers inspect an error's identity, through %w, errors.Is, or errors.As, only when the error is part of the package's contract. Translate implementation errors, such as database driver errors, into contract errors or wrap them with %v.

In the full rule