Let's assume the following code:
func main() {
doStuff()
}
Sound good, until your program runs without any error but does nothing because you just forgot that doStuff()
actually looks like:
func doStuff() error {
// ...
return errors.New("woops!")
}
What we should do ist:
func main() {
err := doStuff()
if err != nil {
panic(err)
}
}
Or at least (to make it obvious):
func main() {
_ = doStuff()
}
There are so many go tools out there like. Is there a simple way to check my code for not handled error return values?