'How to debug Go tests with param "./..." in VS Code
I usually run go test ./... to run all tests in my project.
How can I set up launch.json to debug every tests that normally go test ./... runs?
Solution 1:[1]
Assuming you're using the Go extension for VSCode:
As the vscode-go's documentation says, you could use the following:
{
"name": "Launch test package",
"type": "go",
"request": "launch",
"mode": "test",
"program": "${workspaceFolder}"
}
Note that you're specifying a new mode called "test".
You have to install delve in order to debug code using VSCode. You can install it by yourself or use the Go: Install/Update Tools command from VSCode. Read the documentation I mention first for more information.
Solution 2:[2]
This one should work
{
"name": "Launch test package",
"type": "go",
"request": "launch",
"mode": "test",
"program": "${workspaceFolder}/controllers"
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Flimzy |
| Solution 2 | shailesh gavathe |
