debugging 如何调试需要sudo才能在vscode中运行的go程序?

wwodge7n  于 2022-11-14  发布在  Vscode
关注(0)|答案(1)|浏览(251)

我正在我的远程vscode服务器上编写一个关于网络的go程序。该程序需要sudo才能运行,我想调试该程序。那么我如何在我的远程vscode服务器上调试它呢?似乎launch.json没有提供sudo选项

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Package",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${file}"
        }
    ]
}
bnl4lu3b

bnl4lu3b1#

https://github.com/golang/vscode-go/wiki/debugging#debug-a-program-as-root

{
...
    "asRoot": true,
    "console": "integratedTerminal",
...
}

相关问题