3 ms·
Go's error handling is very annoying, or quirky, or inconsistent. I can't find the right word. On the one hand you have to boilerplate EVERYTHING, check for er
by knorker 8y ago
Go's error handling is very annoying, or quirky, or inconsistent. I can't find the right word.
On the one hand you have to boilerplate EVERYTHING, check for errors ALL THE TIME. The benefit being "what's there is there. No magic data flows".
On the other hand you also have to write exception-safe code (BUT DON'T USE EXCEPTIONS!… at least not on purpose…).
Words exist to have meaning, and there's a precise and accurate word for what Go calls "panics", and that word is exceptions.
But most Go programs code as-if the language doesn't have exceptions, and thus don't write exception-safe code.
(and don't say that a panic should kill the task. fmt printer functions and HTTP handlers have their panics swallowed, so that's not a feasible assumption)