【Go】使用VSCode启动debug模式的Go程序提示go.mo异常解决

问题背景

使用VSCode Start Debugging后

控制台打印:

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

 

解决办法

进入当前go文件所在的目录下

执行

go mod init 模块名

再Start Debugging就好了

 

问题原因(AI生成) 

posted @ 2025-07-03 15:20  onejay  阅读(29)  评论(0)    收藏  举报