# Go-Notes **Repository Path**: sylaryip/Go-Notes ## Basic Information - **Project Name**: Go-Notes - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-07-06 - **Last Updated**: 2020-12-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README [Golang基础入门笔记](https://github.com/Echo-Mr-Pengw/Go-Notes),代码示例都放在[GitHub](https://github.com/Echo-Mr-Pengw/Go-Notes)上,后面会不断更新,出现有误,请各位读者指出。欢迎`Star`和`Fork` ## 主要分为以下章节 #### [第一章节 变量](https://github.com/Echo-Mr-Pengw/Go-Notes/tree/master/%E5%8F%98%E9%87%8F) [1. 一次性声明单个变量的三种方式](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E5%8F%98%E9%87%8F/example/variable1.go) [2. 一次性声明多个变量的三种方式](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E5%8F%98%E9%87%8F/example/variable2.go) [3. 全局变量的声明](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E5%8F%98%E9%87%8F/example/variable3.go) [4. 变量的重新赋值](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E5%8F%98%E9%87%8F/example/variable4.go) [5. 变量的重新声明](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E5%8F%98%E9%87%8F/example/variable5.go) #### [第二章节 条件语句](https://github.com/Echo-Mr-Pengw/Go-Notes/tree/master/%E6%9D%A1%E4%BB%B6%E8%AF%AD%E5%8F%A5) [1. if单双支条件语句的使用](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E6%9D%A1%E4%BB%B6%E8%AF%AD%E5%8F%A5/example/if.go) [2. switch条件语句的使用及注意事项](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E6%9D%A1%E4%BB%B6%E8%AF%AD%E5%8F%A5/example/switch.go) [3. fallthrough(switch穿透)的使用及注意事项](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E6%9D%A1%E4%BB%B6%E8%AF%AD%E5%8F%A5/example/switchFallthrough.go) #### [第三章节 循环语句](https://github.com/Echo-Mr-Pengw/Go-Notes/tree/master/%E5%BE%AA%E7%8E%AF%E8%AF%AD%E5%8F%A5) [1. for循环语句声明及使用的三种方式](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E5%BE%AA%E7%8E%AF%E8%AF%AD%E5%8F%A5/example/for.go) [2. goto语句的使用](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E5%BE%AA%E7%8E%AF%E8%AF%AD%E5%8F%A5/example/goto.go) #### [第四章节 运算符](https://github.com/Echo-Mr-Pengw/Go-Notes/tree/master/%E8%BF%90%E7%AE%97%E7%AC%A6) [1. 算数运算符](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E8%BF%90%E7%AE%97%E7%AC%A6/example/arithmeticOperator.go) [2. 赋值运算符](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E8%BF%90%E7%AE%97%E7%AC%A6/example/assignmentOperators.go) [3. 比较运算符](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E8%BF%90%E7%AE%97%E7%AC%A6/example/comparisonOperators.go) [4. 逻辑运算符](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E8%BF%90%E7%AE%97%E7%AC%A6/example/logicalOperators.go) [5. 其它预算符](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E8%BF%90%E7%AE%97%E7%AC%A6/example/otherOperators.go) #### [第五章节 函数](https://github.com/Echo-Mr-Pengw/Go-Notes/tree/master/%E5%87%BD%E6%95%B0) [1. init函数的作用以及执行顺序](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E5%87%BD%E6%95%B0/init.go) [2. 函数的定义和多返回值的使用](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E5%87%BD%E6%95%B0/func1.go) [3. 匿名函数](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E5%87%BD%E6%95%B0/func2.go) [4. 全局匿名函数](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E5%87%BD%E6%95%B0/func3.go) [5. 闭包函数](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E5%87%BD%E6%95%B0/closure.go) [6. defer 延时机制](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E5%87%BD%E6%95%B0/defer.go) #### [第六章节 指针](https://github.com/Echo-Mr-Pengw/Go-Notes/tree/master/%E6%8C%87%E9%92%88) [1. 指针的定义和使用](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E6%8C%87%E9%92%88/example/ptr1.go) [2. 指针作为参数传递(引用传递)](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E6%8C%87%E9%92%88/example/ptr2.go) [3. 指向指针的指针](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E6%8C%87%E9%92%88/example/ptr3.go) #### [第七章节 数组](https://github.com/Echo-Mr-Pengw/Go-Notes/tree/master/%E6%95%B0%E7%BB%84) [1. 数组的声明](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E6%95%B0%E7%BB%84/example/arr1.go) [2. 数组的初始化](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E6%95%B0%E7%BB%84/example/arr2.go) [3. 数组的获取及遍历](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E6%95%B0%E7%BB%84/example/arr3.go) [4. 数组作为参数传递(值传递和引用传递)](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E6%95%B0%E7%BB%84/example/arr4.go) #### [第八章节 切片](https://github.com/Echo-Mr-Pengw/Go-Notes/tree/master/%E5%88%87%E7%89%87) [1. 切片的定义及使用](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E5%88%87%E7%89%87/example/slice1.go) [2. 切片的遍历](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E5%88%87%E7%89%87/example/slice2.go) #### [第九章节 map](https://github.com/Echo-Mr-Pengw/Go-Notes/tree/master/map) [1. map的声明及初始化](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/map/example/map1.go) [2. map的增删改查及遍历](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/map/example/map2.go) [3. map 是引用类型 ](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/map/example/map3.go) #### [第十章节 struct](https://github.com/Echo-Mr-Pengw/Go-Notes/tree/master/struct) [1. 结构体的定义及声明](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/struct/example/struct1.go) [2. 结构体 值类型](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/struct/example/struct2.go) [3. 结构体 方法](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/struct/example/struct3.go) [4. 结构体 标签](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/struct/example/struct4.go) #### [第十一章节 错误处理](https://github.com/Echo-Mr-Pengw/Go-Notes/tree/master/%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86) [1. 错误处理机制](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86/example/error1.go) [2. 自定义错误 ](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86/example/error2.go) #### [第十二章节 继承](https://github.com/Echo-Mr-Pengw/Go-Notes/tree/master/%E7%BB%A7%E6%89%BF) [1. 继承的定义](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E7%BB%A7%E6%89%BF/example/extends1.go) [2. 继承使用细节之一](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E7%BB%A7%E6%89%BF/example/extends2.go) [3. 继承使用细节之二](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E7%BB%A7%E6%89%BF/example/extends3.go) [4. 继承使用细节之三](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E7%BB%A7%E6%89%BF/example/extends4.go) [5. 继承使用细节之四](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E7%BB%A7%E6%89%BF/example/extends5.go) [6. 继承使用细节之五](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E7%BB%A7%E6%89%BF/example/extends6.go) [7. 继承使用细节之六](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E7%BB%A7%E6%89%BF/example/extends7.go) #### [第十三章节 接口](https://github.com/Echo-Mr-Pengw/Go-Notes/tree/master/%E6%8E%A5%E5%8F%A3) [1. 接口的定义及使用](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E6%8E%A5%E5%8F%A3/example/interface1.go) [2. 自定义类型实现多个接口](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E6%8E%A5%E5%8F%A3/example/interface2.go) [3. 接口可以继承多个接口](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E6%8E%A5%E5%8F%A3/example/interface3.go) [4. 接口是引用类型,空接口返回nil](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/%E6%8E%A5%E5%8F%A3/example/interface4.go) #### [第十四章 goroutine](https://github.com/Echo-Mr-Pengw/Go-Notes/tree/master/goroutine) [1. goroutine的简单属使用](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/goroutine/goroutine1.go) #### [第十五章节 channel](https://github.com/Echo-Mr-Pengw/Go-Notes/tree/master/channel) [1. 管道的声明及简单使用](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/channel/example/chan1.go) [2. 声明单向管道 可写或者可读](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/channel/example/chan2.go) [3. select 解决管道阻塞问题](https://github.com/Echo-Mr-Pengw/Go-Notes/blob/master/channel/example/chan3.go)