Hacker News new | ask | show | jobs
by danenania 641 days ago
Personally I find it much faster to pinpoint errors in the Go style.

With a stack trace, I have to cross-reference with code (ensuring versions match) and filter out a bunch of irrelevant calls in the stack. It’s not uncommon for the stack trace to end deep in library code with the root cause being many calls removed, making me check through a bunch of call sites to figure out what happened.

In Go if good context is added to errors, an error log is generally enough on its own to make it obvious exactly what went wrong.

1 comments

Adding good context is also possible with exceptions.

I think people often compare good Go code with, say, bad Python code where every good practice has been ignored. Go is new and people who write Go are more likely to be skilled and enthusiastic about its design philosophy, so it is somewhat true that Go code is more likely to be high quality.

There's nothing Go error handling does that cannot be done with exceptions. When it comes to bad code, bad Go code is likely to ignore errors or have no context, whereas bad Python code is less likely to ignore errors and at least a raw stacktrace has some context.

This is an argument as old as time though.