I'm creating a CLI just to learn a bit more about Go. Is it possible to intercept all errors and panics, so I can have one unique place to handle them, and also format it and after print to stdout.
Example:
Instead of using:
x, err := doSomething()
if err != nil {
errorHandler.Handler(err)
}
I could just use initialize the code that can intercept all errors before doing anything:
errorHandler.New()
And then I could just "ignore" all errors:
x, _ := doSomething()
Is that a bad practice with Go?