I have a go program using cobra commands. I can run and debug a command with
{
"name": "Reporting1",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "main.go",
"args":["Reporting1"],
"console": "integratedTerminal"
},
This will start Reporting1 in debug mode. I have a Reporting_test.go
//go:build unit
// +build unit
package cmd
import (
"testing"
)
func TestReportingCmd(t *testing.T) {
t.Parallel()
...
When executing "go test ./cmd/... --short -v -json -tags=unit
" It runs all the tests, also the ones from the other commands but I am unable to do it in debugger mode. Is there any launch configuration which will allow me to debug it with VS Code?
Thanks
Eckard.
I have tried any kind of arguments in lauch.json for "program": "main.go" and "args" but did not got it running.
"program": "Reporting_test.go"
did not work because inside I call the reporting function which is defined via Reproting_generated.go where the reportingCmd is called which is implemented in executeReporting.go
It would be OK to just run one test or all the tests at once in debug mode.