File tree Expand file tree Collapse file tree 4 files changed +36
-2
lines changed
Expand file tree Collapse file tree 4 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 1313### A struct null value is an empty Struct with "all members are null values" instead of nil,
1414
1515### You cannot simply determine whether a struct is nil, because it can never be nil. You can determine whether it is empty by returning an error
16- ### Common practice in golang standard library: if err! = nil
16+ ### Common practice in golang standard library: if err! = nil
17+
18+
19+ ### usual type nil
20+
21+ ```
22+ bool -> false
23+ numbers -> 0
24+ string -> ""
25+
26+ pointers -> nil
27+ slices -> nil
28+ maps -> nil
29+ channels -> nil
30+ functions -> nil
31+ interfaces -> nil
32+ ```
Original file line number Diff line number Diff line change @@ -23,3 +23,4 @@ The notes only sort out some important and difficult-to-understand knowledge poi
2323
2424#### zh_CN 中文
2525[ README_CN] ( https://github.com/iotd/jackliu-golang-notes/tree/master/zh_CN )
26+
Original file line number Diff line number Diff line change @@ -40,7 +40,9 @@ func main() {
4040
4141
4242
43- ### goroutine usage
43+ ### goroutine 用法
44+
45+
4446
4547
4648
Original file line number Diff line number Diff line change 1414
1515### 不能单纯地判断一个struct是不是nil,因为它永远不可能是nil,可以通过返回一个error来判断是否为空,
1616### golang标准库里的常见做法:if err != nil
17+
18+ ### 常见类型的 nil
19+
20+ ```
21+ bool -> false
22+ numbers -> 0
23+ string -> ""
24+
25+ pointers -> nil
26+ slices -> nil
27+ maps -> nil
28+ channels -> nil
29+ functions -> nil
30+ interfaces -> nil
31+ ```
You can’t perform that action at this time.
0 commit comments