社区微信群开通啦,扫一扫抢先加入社区官方微信群
社区微信群
在【环境变量】中添加如下【用户变量】:GO111MODULE
,值为on
%GOPATH%/src/<project path>
go mod init
或
go mod init github.com/you/hello
main.go
,并添加测试代码package main
import "github.com/gin-gonic/gin"
func main() {
r := gin.Default()
r.GET("/ping", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "pong",
})
})
r.Run() // listen and serve on 0.0.0.0:8080
}
%GOPATH%/pkg/mod
中go build
1.Go模块官方文档(英文)https://github.com/golang/go/wiki/Modules
2.Go模块简明教程(Go语言依赖包管理工具)https://github.com/wuyumin/tutorial/tree/master/zh-cn/Modules
转载请注明:作者gisxiaowei,首发简书 jianshu.com
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!