Skip to content

Commit 8e53a2f

Browse files
committed
🚀
1 parent 833c61c commit 8e53a2f

13 files changed

+14
-14
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

5.数组Array.md renamed to 05.数组 array.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 数组Array
1+
## 数组 `array`
22
-定义数组的格式 `var <varName> [n]<type>` , n 必须 >=0
33
-数组长度也是类型的一部分,因此具有不同长度的数组的不同类型
44
-注意区分指向数组的指针和指针数组

6.切片Slice.md renamed to 06.切片 slice.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 切片Slice
1+
## 切片 `slice`
22
-其分身并不是数组,他指向底层的数组
33
-作为变长数组的替代方案,可以关联底层数组的局部或全部
44
-为引用类型
@@ -36,7 +36,7 @@
3636

3737
fmt.Println(sl)
3838

39-
## Slice 与底层数组的对应关系
39+
## `slice` 与底层数组的对应关系
4040
![Slice 与底层数组的对应关系](./resource/slice_about.png)
4141

4242
Array_ori := []byte{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k'}
@@ -45,12 +45,12 @@
4545
Slice_b := Array_ori[3:5]
4646
fmt.Println(string(Slice_b))
4747

48-
## Reslice
49-
-`Reslice`时索引以被 `slice` 的切片为准
48+
## `reslice`
49+
-`reslice`时索引以被 `slice` 的切片为准
5050
-索引不可以超过被 `slice` 的切片的容量 `cap()`
5151
-索引越界不会导致底层数组的重新分配而是引发错误
5252

53-
## Append
53+
## `append`
5454
-可以在 `slice` 尾部追加元素
5555
-可以将一个 `slice` 追加在另一个 `slice` 尾部
5656
-如果最终长度未超过追加到 `slice` 的容量则返回原始 `slice`
@@ -65,7 +65,7 @@
6565
a = append(a, 1, 2, 3)
6666
fmt.Printf("%v %p\n", a, a)
6767

68-
## Copy
68+
## `copy`
6969

7070
a := []int{1,2,3,4,5,6}
7171
b := []int{7,8,9}

7.Map.md renamed to 07.map.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Map
1+
## `map`
22
-类似其他语言中的哈希表或者字典,以 `key-value` 形式存储数据
33
-`key` 必须是支持 `==``!=` 比较运算的类型,不可以是函数,`map``slice`
44
-`map` 查找比线性搜索快很多,但比使用索引访问数据的类型慢100倍

8.函数Function.md renamed to 08.函数 function.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 函数Function
1+
## 函数 `function`
22
-Go 函数**不支持** 嵌套,重载 和 默认函数
33
-但支持一下特性:
44
&nbsp;&nbsp;&nbsp;&nbsp;无需声明原型,不定长度变参,多返回值,命名返回值参数,匿名函数,闭包
@@ -55,7 +55,7 @@
5555
}
5656
}
5757

58-
## 延迟调用函数 defer
58+
## 延迟调用函数 `defer`
5959
-在函数体执行结束后按照调用顺序的**相反顺序**逐个执行
6060
-**即使函数发生严重错误也会执行**
6161
-支持匿名函数的调用

9.结构Struct.md renamed to 09.结构 struct.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 结构Struct
1+
## 结构 `struct`
22
-Go 中的 `struct` 与 C 中的 `struct` 非常相似,并且 Go 没有 `class`
33
-使用 `type <Name> struct{}` 定义结构,名称遵循可见性规则
44
-支持指向自身的指针类型成员

10.方法Method.md renamed to 10.方法 method.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 方法Method
1+
## 方法 `method`
22
-Go 中虽没有 `class` ,但依旧有 `method`
33
-通过显示说明 `receiver` 来实现与某个类型的组合
44
-只能为同一个包中的类型定义方法

11.反射Reflection.md renamed to 11.反射 reflection.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 反射Reflection
1+
## 反射 `reflection`
22
-反射可以大大提高程序的灵活性,使得 `interface{}` 有更大的发挥余地
33
-反射使用 `TypeOf``ValueOf` 函数从接口中获取目标对象信息
44
-反射会将匿名字段作为独立字段(匿名字段本质)

11.接口Interface.md renamed to 11.接口 interface.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 接口Interface
1+
## 接口 `interface`
22
-接口是一个或多个方法签名的集合
33
-只要某个类型拥有该接口的索引方法签名,即算实现该接口,无需显示声明实现了哪个接口,这称为 `Structural Typing`
44
-接口只有方法声明,没有实现,没有数据字段
File renamed without changes.

0 commit comments

Comments
 (0)