使用go mod 是不会出现这种问题的,原因是在创建项目的时候勾选了 go vender ,所以重新创建一个项目不要勾选go vender
当然,你依然可以一下操作
解决方案如下
希望能帮助到你
现版本的 gopath目录 变成了一个存放依赖的地方
把gopath 目录下的 目录复制到 goroot目录下的src目录下即可
另外还有这个
如果觉得《build constraints exclude all Go file GOland 导入“github.com/gin-gonic/gin“ 报红》对你有帮助,请点赞、收藏,并留下你的观点哦!