Error comparison pitfalls (#50-51)
Official 100go coverage of mistakes #50-51; the anchor points at #50 and the adjacent section covers both typed and value-based error comparison pitfalls.
Official 100go coverage of mistakes #50-51; the anchor points at #50 and the adjacent section covers both typed and value-based error comparison pitfalls.
- Author: Teiva Harsanyi
- Authority: community
- Kind: guide
- URL: https://100go.co/#comparing-an-error-type-inaccurately-50
What it covers
- sentinel comparison
- typed error inspection
- avoiding brittle direct comparisons
Why authoritative
Official 100go website entries for related error-comparison mistakes.
Use when
- how should I compare this error in Go
- should this use errors.Is or errors.As
- why is direct error equality failing here
Keywords
- error comparison, errors.Is, errors.As, sentinel errors, typed errors