摘要: golang的数组是用花括号括起来的。 Method A method is just a function with a receiver. method: func (v type1) Abs() type2{ } v.Abs() function: func Abs(v type1) type 阅读全文
posted @ 2022-06-14 22:22 hiccuper- 阅读(27) 评论(0) 推荐(0)
摘要: 指针Pointer 定义 var p *int,zero value为nil p = &i 生成指向对象i的指针 *p 实际操作的是 i 结构体struct type Vertex struct{ X, Y int } 使用点获取结构体变量的字段值 结构体变量可如此初始化Vertex{X: 1} Y 阅读全文
posted @ 2022-05-27 16:11 hiccuper- 阅读(68) 评论(0) 推荐(0)
摘要: go mod init [module path] This command creates a new go.mod file in the current directory. It means a new module is rooted at the current directory. g 阅读全文
posted @ 2022-05-21 15:39 hiccuper- 阅读(33) 评论(0) 推荐(0)
摘要: Golang manages dependencies by modules. A module is a collection of packages. Modules can be downloaded from version control repositories or from modu 阅读全文
posted @ 2022-05-19 17:13 hiccuper- 阅读(33) 评论(0) 推荐(0)