Goland debug 报错:could not launch process: decoding dwarf section info at offset 0x0: too short

Goland debug 报错:

could not launch process: decoding dwarf section info at offset 0x0: too short

解决方法:

  • 如果编译时使用了 -ldflags "-s -w" 参数需要去掉,再尝试。因为这个参数去掉了debug 信息
  • 点击Console页的小加号展开,查看 dlv.exe 位置。是否支持你的 go 版本?(不支持会提示),dlv.exe 在 Goland安装目录下找,如图
    Goland debug 报错:could not launch process: decoding dwarf section info at offset 0x0: too short_第1张图片
    在系统命令行下安装,不要在Goland 的 Terminal 下安装,会报错
    set GOPROXY=https://goproxy.cn
    go get -u github.com/go-delve/delve/cmd/dlv
    
    完成后,去你的 GoPath 目录(例如:C:\Users\XXX\go\bin\dlv.exe)找到 dlv.exe 这个文件,看它的修改日期,应该是新创建的。
    复制并替换 Goland 安装目录下的那个dlv.exe,比如我的就是:
    D:\JetBrains\GoLand 2019.1.3\plugins\go\lib\dlv\windows\dlv.exe

你可能感兴趣的:(Go,Goland,debug)