37 lines
780 B
Lua
37 lines
780 B
Lua
local dap = require("dap")
|
|
print("You opened a Golang file")
|
|
|
|
dap.adapters.delve = {
|
|
type = 'server',
|
|
port = '${port}',
|
|
executable = {
|
|
command = 'dlv',
|
|
args = {'dap', '-l', '127.0.0.1:${port}'},
|
|
}
|
|
}
|
|
|
|
-- https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_dap.md
|
|
dap.configurations.go = {
|
|
{
|
|
type = "delve",
|
|
name = "Debug",
|
|
request = "launch",
|
|
program = "${file}"
|
|
},
|
|
{
|
|
type = "delve",
|
|
name = "Debug test", -- configuration for debugging test files
|
|
request = "launch",
|
|
mode = "test",
|
|
program = "${file}"
|
|
},
|
|
-- works with go.mod packages and sub packages
|
|
{
|
|
type = "delve",
|
|
name = "Debug test (go.mod)",
|
|
request = "launch",
|
|
mode = "test",
|
|
program = "./${relativeFileDirname}"
|
|
}
|
|
}
|