Defer, Panic, and Recover 4 August 2010 Go has the usual mechanisms for control flow: if, for, switch, goto. It also has the go statement to run code in a separate goroutine. Here I'd like to discuss some of the less common ones: defer, panic, and re…
最严谨的方式,Always检查error,并做相应的处理 项目结构: 代码: common.go: package common import ( "github.com/pkg/errors" ) func Functest(a int64, b int64) (c int64, err error) { || b < { return c, errors.New("a or b is invalid") } c = a * b return c, err…