英文:
How can I launch a debug session in VSCode with multiple go files?
问题
我在main
包中有两个.go
文件。
我可以使用命令go run main.go plugin.go
来运行它们。
我也可以使用dlv来调试它们,命令是dlv debug main.go plugin.go
。
但是我不知道如何在VSCode中调试它们,因为launch.json
文件中的program
键只能接受一个go文件作为值。
这是我的launch.json
文件:
{
"name": "player",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/playerserver/main.go",
"args": ["playerserver.conf.json"]
}
英文:
I have two .go
files in the main
package.
I can run them with command go run main.go plugin.go
.
I can also debug them with dlv dlv debug main.go plugin.go
.
But I don't know how to debug them in VSCode, since the program
key in launch.json
can take only one go file as value.
This is my launch.json
file
{
"name": "player",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/playerserver/main.go",
"args": ["playerserver.conf.json"]
}
答案1
得分: 1
将param
属性设置为指向主包目录。
{
"name": "player",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "playerserver",
}
https://github.com/microsoft/vscode-go/issues/1229#issuecomment-473731132
英文:
Set param
attribute points to main package directory.
{
"name": "player",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "playerserver",
}
https://github.com/microsoft/vscode-go/issues/1229#issuecomment-473731132
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论