Golang 学习

配置 Golang 开发环境

  1. 安装 gvm
  2. gvm listall 查看可用版本
  3. gvm install $version -B 安装二进制版本,这样比较快
  4. gvm use $version --default
  5. 设定 GOPATH
  6. 配置代理,https://goproxy.io/ 或者 https://goproxy.cn/
  7. 重启 shell
  8. go env 确认 Go 环境变量
  9. 安装 shell 补全工具,https://github.com/posener/complete/tree/master
  10. 重启 shell
  11. 安装 gopls
  12. 安装 gotags
  13. 配置你的编辑器

入门资料

  1. Go by Example 中文版
  2. X 分钟速成 Y - Go
  3. https://tour.go-zh.org/
  4. Draveness - Go 语言设计与实现
  5. https://github.com/a8m/golang-cheat-sheet
  6. https://go.dev/ref/spec
  7. Go 语言圣经

命令

https://golang.org/cmd/go

REPL

  • https://play.golang.org/
  • https://github.com/motemen/gore

目录规范

一般遵循 project-layout

但也有少部分项目是直接源代码平铺在项目根目录的。

编码规范