Go:null judge
null judge
int 空值是 0,
string 空值是””而不是 null 或者 nil(区别
Slice 空值是长度为 0 的
map 空值是 nil,
error 空值是 nil,
struct 空值是一个“所有成员都是空值”的空 Struct 而不是 nil,
不能单纯地判断一个 struct 是不是 nil,因为它永远不可能是 nil,可以通过返回一个 error 来判断是否为空,
golang 标准库里的常见做法:if err != nil
Go:null judge



