安装go

apt install -y golang
docker run -it golang bash

初始化模块

go mod init <module_name>

运行程序

go run main.go

构建程序

go build

安装依赖

go mod tidy

运行测试

go test ./...

格式化代码

go fmt ./...

代码检查

go vet ./...

查看依赖

go mod graph

清理缓存

go clean -modcache

交叉编译

GOOS=linux GOARCH=amd64 go build