1. 接下来安装gin,框架文档介绍:go get -u github.com/gin-gonic/gin

  2. 这时候开始遇到问题了,常遇问题资源加载不了,解决方法是使用代理(这块有个 go env 的命令,可以查看当前配置),在cmd中运行:

go env -w GO111MODULE=on

go env -w goproxy=https://goproxy.io,direct

设置后运行:
go get -u github.com/gin-gonic/gin

 golang安装gin框架报错 cannot find module providing package github.com/gin-gonic/gin: working directory is not part of a module

执行下列命令:

go mod init gin
go mod edit -require github.com/gin-gonic/gin@latest
go mod vendor