golang自学仓库
《Go 语言程序设计》:https://books.studygolang.com/gopl-zh/; https://github.com/golang-china/gopl-zh
《Go 语言底层设计》:https://draveness.me/golang/
《Go 编程模式》:https://coolshell.cn/articles/21128.html(陈皓)
《Go 编程风格指南》:https://github.com/uber-go/guide/blob/master/style.md
《Go 编程风格指南》- 中译版:https://github.com/xxjwxc/uber_go_guide_cn
《Go-advice》:https://github.com/cristaloleg/go-advice/blob/master/README_ZH.md
《go by example》:英文版:https://gobyexample.com 中文版:https://gobyexample-cn.github.io
如果项目是在 windows 下编写的,则需要交叉编译
GOOS=linux GOARCH=amd64 go build flysnow.org/hello // gitbash
// cmd
go env -w GOOS=linux
go build .
vim /etc/supervisor/conf.d/kratos_demo.conf
#/etc/supervisor/conf.d/kratos_demo.conf
[program:kratos_demo]
directory=/root/go/src/sites/kratos-demo/cmd
command=/root/go/src/sites/kratos-demo/cmd/cmd -conf ../configs
autostart=true
autorestart=true
stderr_logfile=/var/log/kratos-demo.err
stdout_logfile=/var/log/kratos-demo.log
environment=CODENATION_ENV=prod
environment=GOPATH="/root/go"
在跳板机或是无法直接用 ftp 连的时候,方便起见就可以直接运行 rz -be
命令,这个命令只能上传文件,所以如果碰到附带文件夹的话,建议还是压缩包文件再上传。
"protoc": {
"options": [
"--proto_path=${env.GOPATH}/pkg/mod/github.com/go-kratos/kratos/v2@v2.0.0-alpha6/third_party"
]
},
点击 File -> Preferences -> Settings
添加如下节点:
"go.testEnvVars": {
"Environment":"dev"
}
"go.testFlags": [
"-count=1"
],
"go.testTimeout": "300s"