gin报错 cannot find module providing package github.com/gin-gonic/gin: working directory is not pa...

使用gin时候,运行报错,因为使用 GOPROXY 的时候,开启了 GO111MODULE,导致包管理非官方所说的在 $GOPATH\src\,而是去了 $GOPATH\src\pkg\目录下,此时就需要用go mod引入这些包 require github.com/gin-gonic/gin@latest ,解决import获取不了包的问题。


执行命令

go mod init gin

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



你可能感兴趣的:(gin报错 cannot find module providing package github.com/gin-gonic/gin: working directory is not pa...)