News for hackers. Stuff that matters.
Re:Errors are values by latch on Monday January 12, 2015 @08:51PM (#8877666)
I'm a Go developer, but I don't buy this. At best it's showing how, with a bit of work (often times by the developer), errors aren't that bad. But I don't see how it's showing that it's better?

If you log the error when checking if ew.err != nil, which might be many lines or even a different function, you'll have a hard time getting a meaningful context (which is hard to do in Go in the best case), like a stack.

Re:Errors are values by enneff on Tuesday January 13, 2015 @05:56AM (#8879033)
The point is not to use this exact pattern, but to write code to handle errors in a way that works in your context. If the error check is many lines away or in a different function, you should use a different approach.
Re:Errors are values by axman6 on Tuesday January 13, 2015 @01:10AM (#8878430)
One way I could see to make this more generic is to provide the errWriter strict with a function to call on the error if it's not nil, but i'm not familiar enough with Go to know how we'll thug might work.