Delve
's native DAP implementation is now available to be used to debug Go programs.
This debug adapter runs in a separate go
process, which is spawned by VS Code when you debug Go code. Since dlv dap
is under active development, we recommend that dlv
be installed at master to get all recent updates.
$ GO111MODULES=on go get github.com/go-delve/delve@master
Please see the Debug Adapter Protocol (DAP) to understand how the Debug Adapter acts as an intermediary between VS Code and the debugger (Delve).
Follow along with golang/vscode-go#23 and the project dashboard for updates on the implementation.
You can choose which debug adapter to use with the "debugAdapter"
field in your launch configuration. If you do not already have a launch.json
, select create a launch.json file
from the debug pane and choose an initial Go debug configuration.
In your launch configuration, set the "debugAdapter"
field to be "dlv-dap"
. For example, a launch configuration for a file would look like:
{ "name": "Launch file", "type": "go", "request": "launch", "mode": "auto", "program": "${file}", "debugAdapter": "dlv-dap" }
To switch back to the legacy adapter, set "debugAdapter"
to "legacy"
.