Ah. Yes, of course. Pointers always.

I was trying to suggest that creating your own error structs 
in the first place opens a needless Pandora's box.
It is just extra trouble that is trivially avoided
if you simply think of errors as strings, and create them only with 
fmt.Errorf().

Certainly there can be good reasons to do otherwise, but I
feel like beginners would be better off 99% of the time with that guidance.

On Friday, February 14, 2025 at 10:28:34 PM UTC Brian Candler wrote:

The original question is whether you should return values or 
pointers-to-values as errors.

If you're using errors.New() or fmt.Errorf() or similar, then you're 
actually using a pointer-to-value.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/358443e1-2f82-417d-9e27-90f60788ff87n%40googlegroups.com.

Reply via email to