VScode-Go can't load package: package .: no buildable Go source files in

在VScode中调试Go程序时提示:

can't load package: package .: no buildable Go source files in d:my_workspacego_ws
exit status 1
Process exiting with code: 1
 
lauch.json配置如下:

{
"version": "0.2.0",
"configurations": [{

"name": "Launch",
"type": "go",
"request": "launch",
"mode": "debug",
"remotePath": "",
"port": 2345,
"host": "127.0.0.1",
"program": "${workspaceRoot}\",
"env": {},
"args": [],
"showLog": true
}]
}

问题出在"program": "${workspaceRoot}\",将其修改为项目路径,则错误解决。

原文地址:https://www.cnblogs.com/yshyee/p/6734169.html