4 ms·
I agree with this. What I like about the Go method is that all errors are equal -- they look the same if it's a stack of microservices running at different com
by jrockway 5y ago
I agree with this. What I like about the Go method is that all errors are equal -- they look the same if it's a stack of microservices running at different companies, a bunch of goroutines communicating state with each other, or if you're just calling a local function that fails. It's the same every time, and the programmer can cut through the noise and make a complicated error from a complicated system simple, concise, and easy to understand.
People seem mad that they have to plumb around `err`, and that they have to provide useful context with fmt.Errorf. I see that as letting good programmers make good systems. The default in other languages is useless -- line numbers and arguments is all you are allowed to have, and when something goes wrong it takes up your entire screen with noise. Not as good as everyone thinks it is.