You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在VSCodium中运行Delve调试器失败的问题排查求助

Go Delve调试器启动后立即退出问题排查

我在VSCodium中运行Delve(dlv)调试器时遇到启动后立即退出的问题。之前旧版本的Go、dlv和VSCode(调试后端相同)都能正常工作,按F5就能通过默认的“launch package”配置启动dlv和DAP服务器。

当前按F5后,调试控制台输出如下:

Starting: /home/linuxbrew/.linuxbrew/Cellar/go/1.21.6/bin/dlv dap
--listen=127.0.0.1:45303 --log-dest=3 from /home/myuser/Documents/myapp DAP server listening at: 127.0.0.1:45303
Type 'dlv help' for list of commands. Process 112737 has exited with
status 1 Detaching

我在launch.json中添加"logOutput": "dap", "showLog": true后,发现调试环境使用的是go@1.20,但终端执行go version显示为go1.22.0,/home/linuxbrew/.linuxbrew/bin/go version显示为go1.21.7,存在多版本Go冲突情况。

完整调试日志

2024-02-12T10:50:05+11:00 debug layer=dap building from "/home/myuser/Documents/myapp": [go build -o /home/myuser/Documents/myapp/__debug_bin -gcflags all=-N -l .]
2024-02-12T10:50:05+11:00 debug layer=dap launching binary '/home/myuser/Documents/myapp/__debug_bin' with config: {
    "mode": "debug",
    "program": "/home/myuser/Documents/myapp",
    "args": [
        "dap"
    ],
    "cwd": "/home/myuser/Documents/myapp",
    "output": "/home/myuser/Documents/myapp/__debug_bin",
    "dlvCwd": "/home/myuser/Documents/myapp",
    "env": {
        "GOBIN": "/home/linuxbrew/.linuxbrew/Cellar/go@1.20/1.20.14/bin",
        "GOPATH": "/home/linuxbrew/.linuxbrew/Cellar/go@1.20"
    },
    "backend": "default",
    "stackTraceDepth": 50
}

2024-02-12T10:50:05+11:00 debug layer=dap [-> to
client]{"seq":0,"type":"event","event":"initialized"}
2024-02-12T10:50:05+11:00 debug layer=dap [-> to
client]{"seq":0,"type":"response","request_seq":2,"success":true,"command":"launch"}
2024-02-12T10:50:05+11:00 debug layer=dap [<-- from
client]{"seq":3,"type":"request","command":"setFunctionBreakpoints","arguments":{"breakpoints":[]}}
2024-02-12T10:50:05+11:00 debug layer=dap [-> to
client]{"seq":0,"type":"response","request_seq":3,"success":true,"command":"setFunctionBreakpoints","body":{"breakpoints":[]}}
2024-02-12T10:50:05+11:00 debug layer=dap [<-- from
client]{"seq":4,"type":"request","command":"setInstructionBreakpoints","arguments":{"breakpoints":[]}}
2024-02-12T10:50:05+11:00 debug layer=dap [-> to
client]{"seq":0,"type":"response","request_seq":4,"success":true,"command":"setInstructionBreakpoints","body":{"breakpoints":[]}}
2024-02-12T10:50:05+11:00 debug layer=dap [<-- from
client]{"seq":5,"type":"request","command":"configurationDone","arguments":{}}
2024-02-12T10:50:05+11:00 debug layer=dap [-> to
client]{"seq":0,"type":"event","event":"output","body":{"category":"console","output":"Type
'dlv help' for list of commands.
","source":{}}}
2024-02-12T10:50:05+11:00 debug layer=dap [-> to
client]{"seq":0,"type":"response","request_seq":5,"success":true,"command":"configurationDone"}
Type 'dlv help' for list of commands. 2024-02-12T10:50:05+11:00 debug
layer=dap [<-- from
client]{"seq":6,"type":"request","command":"threads"}
2024-02-12T10:50:05+11:00 debug layer=dap [-> to
client]{"seq":0,"type":"response","request_seq":6,"success":true,"command":"threads","body":{"threads":[{"id":-1,"name":"Current"}]}}
2024-02-12T10:50:05+11:00 debug layer=dap [-> to
client]{"seq":0,"type":"event","event":"terminated","body":{}}
2024-02-12T10:50:05+11:00 debug layer=dap [<-- from
client]{"seq":7,"type":"request","command":"disconnect","arguments":{}}
2024-02-12T10:50:05+11:00 debug layer=dap halting
2024-02-12T10:50:05+11:00 debug layer=dap process not running
2024-02-12T10:50:05+11:00 debug layer=dap [-> to
client]{"seq":0,"type":"event","event":"output","body":{"category":"console","output":"Process
116383 has exited with status 1
","source":{}}}
2024-02-12T10:50:05+11:00 debug layer=dap [-> to
client]{"seq":0,"type":"event","event":"output","body":{"category":"console","output":"Detaching
","source":{}}}
2024-02-12T10:50:05+11:00 debug layer=dap [-> to
client]{"seq":0,"type":"response","request_seq":7,"success":true,"command":"disconnect"}
2024-02-12T10:50:05+11:00 debug layer=dap [-> to
client]{"seq":0,"type":"event","event":"terminated","body":{}}
2024-02-12T10:50:05+11:00 debug layer=dap DAP server stopping...
Process 116383 has exited with status 1 Detaching
2024-02-12T10:50:05+11:00 debug layer=dap DAP server stopped dlv dap
(116256) exited with code: 0

Go环境变量输出

GO111MODULE='auto' 
GOARCH='amd64' 
GOBIN='/home/linuxbrew/.linuxbrew/Cellar/go/1.21.6/bin' 
GOCACHE='/home/myuser/.cache/go-build' 
GOENV='/home/myuser/.config/go/env' 
GOEXE='' 
GOEXPERIMENT='' 
GOFLAGS='' 
GOHOSTARCH='amd64' 
GOHOSTOS='linux' 
GOINSECURE='' 
GOMODCACHE='/home/linuxbrew/.linuxbrew/Cellar/go/pkg/mod' 
GONOPROXY='' 
GONOSUMDB='' 
GOOS='linux' 
GOPATH='/home/linuxbrew/.linuxbrew/Cellar/go' 
GOPRIVATE='' 
GOPROXY='https://proxy.golang.org,direct' 
GOROOT='/home/linuxbrew/.linuxbrew/Cellar/go/1.21.7/libexec' 
GOSUMDB='sum.golang.org' 
GOTMPDIR='' 
GOTOOLCHAIN='auto' 
GOTOOLDIR='/home/linuxbrew/.linuxbrew/Cellar/go/1.21.7/libexec/pkg/tool/linux_amd64' 
GOVCS='' 
GOVERSION='go1.21.7' 
GCCGO='gccgo' 
GOAMD64='v1' AR='ar' CC='cc' CXX='c++' 
CGO_ENABLED='1' 
GOMOD='' 
GOWORK='' 
CGO_CFLAGS='-O2 -g' 
CGO_CPPFLAGS='' 
CGO_CXXFLAGS='-O2 -g' 
CGO_FFLAGS='-O2 -g' 
CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' 
GOGCCFLAGS='-fPIC -m64
    -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3254040920=/tmp/go-build -gno-record-gcc-switches'

恳请帮忙排查问题,解决调试器启动失败的故障。

内容的提问来源于stack exchange,提问作者John Doe

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 00:42:01