File tree Expand file tree Collapse file tree 3 files changed +6
-1
lines changed Expand file tree Collapse file tree 3 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,6 @@ if err := json.Unmarshal(data, &titles); err != nil {
104104}
105105fmt.Println (titles) // "[{Casablanca} {Cool Hand Luke} {Bullitt}]"
106106```
107- 通过定义合适的Go语言数据结构,我们可以选择性地解码JSON中感兴趣的成员 。
107+ 通过定义合适的 Go 语言数据结构,我们可以选择性地解码 JSON 中感兴趣的成员 。
108108
109109基于流式的解码器 ` json.Decoder ` 。针对输出流的 ` json.Encoder ` 编码对象
Original file line number Diff line number Diff line change @@ -54,6 +54,8 @@ for key, value := range mapName {
5454```
5555** ` Map ` 的迭代顺序是不确定的。可以先使用 ` sort ` 包排序** 。
5656
57+ #### map 为什么是无序的
58+ 前面知道 map 遍历
5759#### map 的键类型不能是哪些类型
5860` map ` 的键和元素的最大不同在于,前者的类型是受限的,而后者却可以是任意类型的。
5961
Original file line number Diff line number Diff line change @@ -117,11 +117,14 @@ Golang 方法集 :每个类型都有与之关联的方法集,这会影响到
117117```
118118• 类型 T 方法集包含全部 receiver T 方法。
119119• 类型 *T 方法集包含全部 receiver T + *T 方法。
120+
120121• 如类型 S 包含匿名字段 T,则 S 和 *S 方法集包含 T 方法。
121122• 如类型 S 包含匿名字段 *T,则 S 和 *S 方法集包含 T + *T 方法。
122123• 不管嵌入 T 或 *T,*S 方法集总是包含 T + *T 方法。
123124```
124125
126+ ** 对于结构体嵌套匿名字段的类型是指针还是非指针** ,根据实际情况决定。
127+
125128## 嵌入结构体扩展类型
126129``` go
127130import " image/color"
You can’t perform that action at this time.
0 commit comments