logoalt Hacker News

masklinn06/05/20251 replyview on HN

Of course it does. What do you think an errors.New contains and how do you figure it compares by value when checking placeholder errors?

The answer is that errors.New just wraps the error message in an errorString struct, and the second line of `is` is a string comparison.


Replies

kiitos06/06/2025

See for yourself: https://go.dev/play/p/Q7IPuPS5CwQ

show 1 reply