1. 首页
  2. 数据库
  3. 其它
  4. 实例学习Golang–接口(三、error处理)

实例学习Golang–接口(三、error处理)

上传者: 2021-02-01 09:08:27上传 PDF文件 33.11KB 热度 9次
error 接口有一个签名为 Error() string 的方法,所有实现该接口的类型都可以当作一个错误类型。 Error() 方法给出了错误的描述,在使用 fmt.Println 打印错误时,会在内部调用 Error() string 方法来得到该错误的描述。 error 接口的源码: // The error built-in interface type is the conventional interface for // representing an error condition, with the nil value representing no error. type
下载地址
用户评论