英文:
Debug when run a folder
问题
我有一个名为cmd
的文件夹。
当我想运行我的程序时,我需要运行以下命令:
go run cmd/*.go server
,其中server
是一个参数。
但是我不知道如何在VsCode中设置我的程序的调试。
我尝试了以下配置,但都不起作用。
{
"name": "Launch Package Test",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "cmd/main.go cmd/initialize.go cmd/commands.go cmd/pubsub_action.go", // cmd目录中的所有go文件
"cwd": "${workspace}",
"args": [
"server"
]
}
{
"name": "Launch Package Test",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "cmd/*go",
"cwd": "${workspace}",
"args": [
"server"
]
}
{
"name": "Launch Package Test",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "cmd/*",
"cwd": "${workspace}",
"args": [
"server"
]
}
问题是,运行我的应用程序的调试的正确方法是什么?
英文:
I have a folder called cmd
.
When I want to run my program, I need to run the command.
go run cmd/*.go server
where server
is an argument.
But I don't know how to setup the debugging for my program in VsCode.
I have tried these configurations but none of these works.
{
"name": "Launch Package Test",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "cmd/main.go cmd/initialize.go cmd/commands.go cmd/pubsub_action.go", // all go files in the cmd directory
"cwd": "${workspace}",
"args": [
"server"
]
}
{
"name": "Launch Package Test",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "cmd/*go",
"cwd": "${workspace}",
"args": [
"server"
]
}
{
"name": "Launch Package Test",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "cmd/*",
"cwd": "${workspace}",
"args": [
"server"
]
}
The question is, what is the correct way to run debugging for my application?
答案1
得分: 1
找到了解决方案。
{
"name": "启动包测试",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "cmd",
"cwd": "${workspace}",
"args": [
"server"
]
}
将程序设置为 cmd
。
英文:
Found the solution.
{
"name": "Launch Package Test",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "cmd",
"cwd": "${workspace}",
"args": [
"server"
]
}
Set the program to cmd
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论