admin管理员组文章数量:1612097
GOROOT和GOPATH是个神奇的东西,现在还没有搞懂具体的差异在哪,可能以后有了实战经验后就能够解决了。
遇到的问题:
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
背景:
环境变量:
Hello.go文件:
- path中已经定位到GOROOT的bin目录下
- GOROOT的位置也是go的安装路径,因此环境变量的配置是没有问题的。
- 我的Hello.go文件是在GOPATH的路径下,并且文件是可以在vscode中成功运行的。
- 但在VSCode中一直报错为go: go.mod file not found in current directory or any parent directory; see 'go help modules'
解决方案:
cmd中输入:go env -w GO111MODULE=auto
至于报错的原因,还是因为GOPATH的问题,网上给出的答案到目前为止还是看不懂的。。。
本文标签: 解决方案CurrentfileModModules
版权声明:本文标题:go: go.mod file not found in current directory or any parent directory; see ‘go help modules‘解决方案 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1728628062a1166748.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论