go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io,direct
go mod init YourProjectName
go get -u github.com/gin-gonic/gin
---------------或者--------------
1.使用其他镜像资源
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io,direct
因为国内有墙限制,安装bin包需要使用国内镜像。搭梯子就直接跳过此步骤
2.在项目目录下分别执行以下命令
go mod init gin
go mod edit -require github.com/gin-gonic/gin@latest
go mod vendor
OK,这下就run起来了
本文介绍了如何在中国使用goenv设置GOPROXY为国内镜像以解决包下载问题,以及如何在项目中添加gin-gonic/gin模块并进行依赖管理。
1358

被折叠的 条评论
为什么被折叠?



