On Fri, 14 Feb 2025 at 14:05, Jason E. Aten <j.e.a...@gmail.com> wrote:

> I myself still use the classic string based-errors as
> original designed.
>

I'm not sure what you mean here. From its first commit
<https://github.com/golang/go/commit/e4ae30f5f55b6b6ba2cb9a0c0e3b11d42dc162ee>,
the errors package at least returned pointers. That was shortly after the
`error` interface was introduced and even before that existed, package like
`os` used pointer receivers for their error types.
So, from what I can tell, at least, error types have always been designed
using pointer receivers.


> I don't think there is a wide accepted best practice here.
>

I strongly disagree. The standard library exclusively returns pointer type
(except in `package syscall` I believe). There are good, technical reasons
to use pointer receivers. People should use pointer receivers.


> There are
> libraries like "errors" but to me wrapping errors is gratuitous complexity
> that
> only adds noise.  That's not a general consensus; just one practitioner's
> opinion.
>
> --
> 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/b0d1a19c-8025-4c36-ad39-a3c0571de3c9n%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/b0d1a19c-8025-4c36-ad39-a3c0571de3c9n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAEkBMfE%2BtWF8TFdVF0TdbcDN%3DRB3TsL0CvzKPY1nFe%3D6819ZwA%40mail.gmail.com.

Reply via email to