Go环境异常问题go: go.mod file not found in current directory or any parent directory; see ‘go help modules

高版本go(1.17)执行时错误: go: go.mod file not found in current directory or any parent directory; see ‘go help modules’…

解决:参考链接:
https://blog.golang.org/go116-module-changes

再1.16进行了module变更。
所以高版本需要设置一下 :

go env -w GO111MODULE=auto

再次运行程序即可。

posted @ 2021-09-24 13:33  IT当时语_青山师  阅读(48)  评论(0编辑  收藏  举报  来源