Mac下VScode报错go: go.mod file not found in current directory or any parent directory解决方法

2022-06-17 12:17:27

原因是其实go mod根本没启用到,直接把GO111MODULE关掉就可以
在这里插入图片描述
go env -w GO111MODULE=off
在这里插入图片描述
在这里插入图片描述
需要开启时就直接
go env -w GO111MODULE=on

PS:若是未开启mod,cd到自己设定的Gopath
然后输入以下命令

go mod init go
ls查看一下路径里是否有go.mod.pkg
在这里插入图片描述

  • 作者:faduoria
  • 原文链接:https://blog.csdn.net/weixin_43126651/article/details/124409870
    更新时间:2022-06-17 12:17:27