func foobar(a, b int) error {
handle err { return err } // This is our handler
x := check foo(a, b) // check invokes the handle func
y := check bar(a, b) // this on as well
}
看起来还蛮好的。
来源: https://levelup.gitconnected.com/golang-2-0-draft-feature-error-handling-c0a2332b9162
但我觉得还能改进,比如把 handle err { return err } 当作默认行为,不需要写这句就是这个行为,如果写了就覆盖默认行为。
