Hey Axel, this is a good question that I've thought about from time to time as well. It seems that most people in this thread have misunderstood it :)
I personally agree with your preference as given in the examples just because I find the code easier to read when the error return is handled separately. Whenever I read code that handles both the err==nil and err!=nil cases without a branch, I find that it takes me longer to understand why it's correct. So I guess the reason for my preference is not the same as yours -- I don't really take a caller who's misusing my API into account. If the caller is using the return value when err!=nil, I don't care to avoid blowing them up or even to reliably blow them up. -- 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.