我在 Kubuntu 上运行最新的VSCode稳定版本来开发GO程序。自上次更新(VSCode 1.39.0版)以来,我的构建任务不再起作用。我得到的只是调试控制台中的这两行:
/ usr / bin / node --inspect = 17112 --debug-brk
/ usr / bin / node:错误的选择:--inspect = 17112
可悲的是我不知道怎么来的?我最近没有更改项目或任何来源。我也没有在我的任何代码中找到任何-inspect 选项。
我首先运行我的makefile,然后执行生成的可执行文件。几个月以来,效果很好,现在却停止了工作。
这是我的 launch.json :
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type":"node2",
"request": "launch",
"name": "Build and Launch my program",
"program": "",
"args": [],
"preLaunchTask": "make",
"postDebugTask": "execute",
"cwd": "${workspaceFolder}"
}
]
}
这是我的 tasks.json :
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "make",
"type": "shell",
"command": "make",
"args": [],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "silent"
}
},
{
"label": "execute",
"type": "shell",
"command": "${workspaceFolder}/myExecutable",
"args": [
"-c",
"/tmp/myTemp",
"-i",
"-v",
"-l",
"box.log"
],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "silent"
}
}
]
}
我已经尝试用 node 和 protocol 替换 node2 ,但是它的行为完全一样。好像没关系吗?
答案 0 :(得分:0)
我最终用“ go”调试器替换了“ node”或“ node2”调试器。有一个“模式”:“执行”选项,使我可以简单地执行makefile之前编译的程序。
这是我的工作配置:
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type":"go",
"request": "launch",
"name": "Build and Launch my executable",
"mode":"exec",
"program": "${workspaceFolder}/myExecutable",
"args": [
"-c",
"/tmp/regibox",
"-i",
"-v",
"-l",
"box.log"
],
"preLaunchTask": "make",
"postDebugTask": "",
"cwd": "${workspaceFolder}"
}
]
}
这是我的 tasks.json :
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "make",
"type": "shell",
"command": "make",
"args": [],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "silent"
}
}
]
}
有了这个,我可以简单地执行makefile并使用F5运行生成的可执行文件。当然,这种方式无需调试:-(