logoalt Hacker News

packetlost06/04/20252 repliesview on HN

I was actually referring to the implementation of errors.Is, which uses string comparison internally if you use the error type returned by errors.New and a type cast or switch if you use a custom type (or the cases where the stdlib defines a custom error type).


Replies

kiitos06/04/2025

errors.Is definitely doesn't use string comparison internally:

https://cs.opensource.google/go/go/+/refs/tags/go1.24.3:src/...

show 1 reply
Yoric06/06/2025

My bad, I misunderstood your previous comment.