🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
go语言是一种静态强类型、编译型语言 ~~~ `timeStr:=time.Now().Format(``"2006-01-02 15:04:05"``) ``//当前时间的字符串,2006-01-02 15:04:05据说是golang的诞生时间,固定写法` `fmt.Println(timeStr)   ``//打印结果:2017-04-11 13:24:04` ~~~ go 版本发布:[https://golang.org/dl/](https://golang.org/dl/) 这个地址大概率打不开 一个全球代理为 Go 模块而生 [https://goproxy.io/zh/](https://goproxy.io/zh/) ### 设置GOPATH ![](https://img.kancloud.cn/59/0a/590ab3f104b6ea7ad3de763f5d76d80d_517x588.png) ### gopath 下目录文件 |-bin 编译好的二进制文件 .exe |-pkg .a文件 给编译器用的不需要关心 |-src 开发所用的包 ### 查看golang 环境变量 go env ![](https://img.kancloud.cn/75/5e/755e70ad3508041a4041c665c94ddd43_1035x572.png) ~~~shell go env -w GO111MODULE=on go env -w GOPROXY=https://goproxy.io,direct ~~~ ### go mod 使用 使用go mod 管理项目,就不需要非得把项目放到GOPATH指定目录下 新建一个名为 wserver 的项目,项目路径 D:\\test\\wserver (注意,该路径并不在GOPATH里) 1.go mod init name(模块名称)初始化模块,会在项目根目录下生成 go.mod文件。 2.go mod tidy 根据go.mod文件来处理依赖关系。 3.go mod vendor 将依赖包复制到项目下的 vendor目录 相关学习 Go语言入门教程,Golang入门教程(非常详细)[http://c.biancheng.net/golang/](http://c.biancheng.net/golang/) 相关代码实践:http://code.9885.net/Lyn/gostudy.git 新手常犯错误:[https://www.jianshu.com/p/ccda5db7b9df](https://www.jianshu.com/p/ccda5db7b9df)