On Fri, Mar 31, 2017 at 3:33 PM, 'Axel Wagner' via golang-nuts
<golang-nuts@googlegroups.com> wrote:
>
> there recently was a thread on /r/golang, about whether or not to explicitly
> return useless values when an error occurred, or to just not care, as the
> caller isn't supposed to use a return value on a non-nil value anyway.

I follow a simple policy: normally, when returning an error, return
zero values for all the other result parameters.  if there is a reason
to do anything else (e.g., io.Reader explicitly permits returning n >
0 with a non-nil error), then I document the behavior.

I can't say that I fully grasp the argument you are presenting.  I do
feel that it does not make sense to return an invalid, non-zero, value
when returning an error.  What would be the point of that?

Ian

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to