Go - Delve
September 22, 2025 · View on GitHub
To debug Go files, you can use the Delve DAP server.
Let’s debug the following test.go file:
package main
import "fmt"
func main() {
var user = "world";
fmt.Println("hello", user);
}

Configure DAP server
-
After the installation, you should have the
dlvcommand available (make sure to close and reopen your IDE to ensure thedlvcommand is properly recognized).
If you open a terminal and run the following command:
dlv dap
You should see in the terminal traces like this:
DAP server listening at: 127.0.0.1:60732
-
Create a DAP Run/Debug configuration:

-
In the
Servertab, click oncreate a new server:
-
It opens a new dialog to create DAP server, select
Go - Delvetemplate:
-
After clicking on
OKbutton, it will select the new server and pre-fill configurations:

This will automatically populate:
- the server
name - the
commandwhich starts the DAP server which should look like this:
dlv dap
- the
Connect to the server by waitingoption is set toLog pattern before processingwith:
DAP server listening at: ${address}:${port}
This means the DAP (Debug Adapter Protocol) client will connect to the DAP server when this trace appears in the console:
dlv dap
DAP server listening at: 127.0.0.1:60732
Here ${port} will be extracted and client will connect to the 60732 port.
- Enable DAP server traces
If you wish to show DAP request/response traces when you will debug:

you need to select Trace with verbose.

Configure file mappings
To allows settings breakpoints to Go files, you need configure mappings in the Mappings tab.
As you have selected Go - Delve server, it will automatically populate the file mappings like this:

Configure the Go file to run/debug
- Fill in the
Configurationtab:
- the
working directory(usually the project's root directory) - the path to the
test.gofile.

- Select
LaunchasDebug mode. - The DAP parameters of the launch should look like this:
{
"type": "go",
"name": "Launch Go file",
"request": "launch",
"program": "${file}",
"cwd": "${workspaceFolder}"
}
When the run configuration starts:
${workspaceFolder}will be replaced with the working directory you specified.${file}will be replaced with the full path totest.go.
Set Breakpoint
After applying the run configuration, you should set a breakpoint to files which matches file mappings.
Set a breakpoint in the test.go file:

Debugging
You can start the run configuration in either Run or Debug mode. Once started, you should see DAP traces in the console:

You will also see Threads and Variables:

Language Support
If you need language support for Go (completion, validation, etc) you can configure the Go Language Server
