如何解决go.mod file not found in current directory or any parent directory?

环境变量配置:

假如安装路径:/usr/local/go

那么这样配置环境变量:

vi ~/.bash_profile

export GOPATH=$HOME/go

然后保存,执行source ~/.bash_profile

报错go.mod file not found in current directory or any parent directory?

解决:go env -w GO111MODULE=auto

OK,问题解决

猜你喜欢

转载自blog.csdn.net/BenChiZhuBaDaoWang/article/details/131506506