# goLearn **Repository Path**: kinghack001/goLearn ## Basic Information - **Project Name**: goLearn - **Description**: go的学习笔记 - **Primary Language**: Go - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-02-23 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 学习来源: [Go 语言教程 | 菜鸟教程](https://www.runoob.com/go/go-tutorial.html) [Go语言圣经](https://books.studygolang.com/gopl-zh/index.html) go模板 最简 ```go /* 文件说明 * * @link: 引用网页 */ // 包申明 package main // 引入包 import ( "fmt" ) // 入口函数 func main() { } /* 运行结果: */ ``` 目录说明: ``` ├── arrays 数组 │ ├── multi-dimensional-arrays.go 多维数组 │ ├── passing-arrays-to-functions-test1.go 向函数传递数组 │ └── test1.go 数组完整操作(声明、赋值、访问) ├── concurrent 并发 │ ├── test1.go 基本演示 │ ├── test2.go 通道(channel) │ ├── test3.go 通道(channel-通道缓冲区 │ └── test4.go 通道(channel-Go 遍历通道与关闭通道 ├── constants 常量 │ ├── test1.go 常量定义 │ ├── test2.go 常量枚举 │ ├── test3.go iota │ └── test4.go 位移 ├── decision-making 条件语句 │ ├── if-else-statement.go if...else 语句 │ ├── if-statement.go if │ ├── nested-if-statements.go if 语句嵌套 │ ├── select-statement.go select 语句 │ ├── switch-statement-fallthrough.go case 语句,fallthrough │ ├── switch-statement-type.go type-switch │ └── switch-statement.go 条件语句-switch 语句 ├── environment 环境安装验证 │ └── test.go ├── error-handling 错误处理 │ └── test1.go ├── functions 函数 │ ├── function-as-values.go 函数作为实参 │ ├── function-call-by-reference.go 函数引用传递值 │ ├── function-call-by-value.go 函数值传递值 │ ├── function-closures.go 闭包 │ ├── method.go 方法 │ ├── test1.go 函数定义 │ └── test2.go 函数返回多个值 ├── interfaces 接口 │ └── test1.go ├── loops 循环语句 │ ├── break-statement-test1.go break 语句 │ ├── break-statement-test2.go break 语句 多重循环,演示了使用标记和不使用标记的区别 │ ├── continue-statement-test1.go continue 语句 在变量 a 等于 15 的时候跳过本次循环执行下一次循环 │ ├── continue-statement-test2.go continue 语句 │ ├── for-loop-test1.go for 循环 计算 1 到 10 的数字之和 │ ├── for-loop-test2.go for 循环 在 sum 小于 10 的时候计算 sum 自相加后的值 │ ├── for-loop-test3.go For-each range 循环 │ ├── goto-statement.go goto 语句 │ └── nested-loops.go 循环嵌套 ├── map Map(集合) │ ├── test1.go 创建和使用map │ └── test2.go delete() 函数 ├── operators 运算符 │ ├── test1.go 算术运算符 │ ├── test2.go 关系运算符 │ ├── test3.go 逻辑运算 │ ├── test4.go 位运算符 │ ├── test5.go 赋值运算符 │ ├── test6.go 其他运算符 │ └── test7.go 运算符优先级 ├── pointers 指针 │ ├── array-of-pointers.go 定义一个指针数组来存储地址 │ ├── passing-pointers-to-functions.go 指针作为函数参数 │ ├── pointer-to-pointer.go 指向指针的指针 │ ├── test1.go 演示了变量在内存中地址 │ ├── test2.go 如何使用指针 │ └── test3.go 空指针 ├── range 范围(Range) │ └── test1.go ├── recursion 递归函数 │ ├── test1.go 阶乘 │ └── test2.go 斐波那契数列 ├── scope-rules 变量作用域 │ ├── test1.go 局部变量 │ ├── test2.go 全局变量 │ ├── test3.go 初始变量 │ └── test4.go 形式参数 ├── slice 切片 │ ├── test1.go len() 和 cap() 函数 │ ├── test2.go 空(nil)切片 │ ├── test3.go 切片截取 │ └── test4.go append() 和 copy() 函数 ├── structures 结构体 │ ├── test1.go 定义 │ ├── test2.go 访问结构体成员 │ ├── test3.go 结构体作为函数参数 │ └── test4.go 结构体指针 ├── type-casting 类型转换 │ └── test1.go └── variables 变量 ├── test2.go 默认值 ├── test3.go 初始值 └── vartest.go 变量测试 ```