dudu
dudu

Reputation: 71

How can I launch a debug session in VSCode with multiple go files?

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"]
}

Upvotes: 6

Views: 1891

Answers (1)

wow qing
wow qing

Reputation: 442

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

Upvotes: 2

Related Questions