3 ms·
That is exactly how go usually works with error handling though. func mayfail() error { if snafu { return errors.New("oops") }
by kortex 2y ago
That is exactly how go usually works with error handling though.
func mayfail() error {
if snafu {
return errors.New("oops")
} else { return nil}
}
err := mayfail()
if err != nil { handle }
Same as `mayfail() ? handle : happypath` would behave with lazy evaluation.