3 ms·
Yeah but pointer + nil also have issues: https://go.dev/doc/faq#nil_error https://go.dev/doc/faq#nil_error I've also seen APIs that allow returning both error
by progbits 3y ago
Yeah but pointer + nil also have issues: https://go.dev/doc/faq#nil_error https://go.dev/doc/faq#nil_error
I've also seen APIs that allow returning both error and a value ("something went wrong, but here is a fallback or something") which are of course extremely confusing given the usual style.
- goodoldneon 3y agoOh I agree, I've run into too many nil pointer panics. I wish Go had a first-class way of expressing optionality, rather than using pointers