Debugging Delve(dlv)无法连接到进程

Debugging Delve(dlv)无法连接到进程,debugging,go,build,delve,Debugging,Go,Build,Delve,我正在从dlv获取此错误 could not attach to pid 20727: decoding dwarf section info at offset 0x0: too short 二进制文件的构建方式如下: go build -a -v -ldflags "-w -X main.gitCommit=<sha> -linkmode 'auto' -extldflags '-static'" go build-a-v-ldflags“-w-X main.gitCommi

我正在从dlv获取此错误

could not attach to pid 20727: decoding dwarf section info at offset 0x0: too short
二进制文件的构建方式如下:

go build -a -v -ldflags "-w -X main.gitCommit=<sha> -linkmode 'auto' -extldflags '-static'"
go build-a-v-ldflags“-w-X main.gitCommit=-linkmode'auto'-extldflags'-static''

您能否确认是
-w
标志导致了以下问题?它会去除调试符号吗?

在我删除
-w
标志后,delve能够附加到进程上

可能重复的@daplho不是重复的。我现在不使用Goland,我知道,但潜在的问题也有可能是相同的。还有昨天的问题-你在Mac上运行这个吗?