Go 6

error 类型 Error() 方法的无限递归

Go
在 Go 语言中使用 error 值来表示错误状态。事实上,error 类型是内置的接口,定义如下: type error interface { Error() string } 函数一般会返回一个 error 类型的值,因此调用函数时应该通过测试 error 是否等于 nil 来处理错误,如: …...
Read more →