1、go get -u github.com/gin-gonic/gin时候返回go.mod file not found in current directory or any parent directory.
'go get' is no longer supported outside a module.
To build and install a command, use 'go install' with a version,
处理方法:
首先确保下载了gin的包
使用git clone https://github.com/gin-gonic/gin.git
在工作文件夹下载gin包
然后再项目文件夹生成go.mod
go mod init
当看到项目下出现gomod文件即可
go mod tidy
继续安装gin框架
go get -u github.com/gin-gonic/gin
文件夹下出现go.sum 就可以在文件中import gin
import "github.com/gin-gonic/gin"
go run 项目正常了