摘要: 最严谨的方式,Always检查error,并做相应的处理 项目结构: 代码: common.go: godep_common.go 是的,就是这么蛋疼, 所有的error不能忽略,需要检查,导致代码比较冗长。 这种办法代码非常严谨,也是Golang官方期望的方式。Golang的标准库代码也是这么写的 阅读全文
posted @ 2016-11-22 14:23 junneyang 阅读(1658) 评论(0) 推荐(0) 编辑
摘要: 吐血推荐: https://dave.cheney.net/2016/04/27/dont-just-check-errors-handle-them-gracefully 参考资料: https://blog.golang.org/errors-are-values https://dave.ch 阅读全文
posted @ 2016-11-22 13:22 junneyang 阅读(2159) 评论(0) 推荐(0) 编辑