Today I Learned

2025/12/04

go

That not using a pointer reciever for a custom error type can cause runtime panics:

If you use non-pointer values and folks do shallow comparisons without an Is method, you may put yourselves in a bad spot if the error type later includes a non-comparable child field (e.g., map[K]V). See https://go.dev/play/p/7fgO0EY5hWm.

https://www.reddit.com/r/golang/comments/1bd1xzf/seeking_advice_on_custom_error_types_value_vs/