News for hackers. Stuff that matters.
Re:From Python to Go and Back Again by fauigerzigerk on Saturday October 17, 2015 @10:36AM (#10404484)
I agree that error handling in Go is a headache. But since we are forced to handle every single error where it occurs, we can at least make the best of it and add context information before returning it.

I'm using a small utility library to wrap the original error and add function name, line, file name and optionally a descriptive message that explains what failed.

Re:From Python to Go and Back Again by 0x434D53 on Sunday October 18, 2015 @12:31AM (#10407230)
You are not forced to handle errors. Or do you check for the errors returned by fmt.Print? I guess not.

This was my point: In many areas go forces the developer to the right thing (no unnecessary imports, gofmt...) and does not rely on developers discipline. But when i comes to error handling it does.

What i would wish for is some extended error handling supported by the compiler. I don't want a stack trace, but the compiler easily could produce for example a line number where the error was returned.