美文网首页
goland debug运行报错问题

goland debug运行报错问题

作者: Jsolo | 来源:发表于2020-08-08 18:00 被阅读0次

    goland run运行正常,但是debug运行报如下错误

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

    主要是因为缺少dlv, go程序debug需要dlv
    下面是安装dlv的步骤

    百度出来结果都是,执行以下命令,但是我这边测试执行了没反应, 所以后面采用下源码编译的方式

    go get github.com/derekparker/delve/cmd/dlv
    

    第一步,从github上下载dlv源程序

    git clone https://github.com/go-delve/delve.git %GOPATH%/src/github.com/go-delve/delve
    

    然后cd到%GOPATH%/src目录,执行

    go install github.com/go-delve/delve/cmd/dlv
    

    这时候你发现,在 %GOPATH%/bin目录下生产了一个dlv.exe程序


    image.png

    我习惯把dlv.exe放到go安装目录,所以我把dlv.exe拷贝到go安装目录下

    C:\Go\bin\dlv.exe
    

    打开 Goland 的 Help->Edit Customer Properties,若提示文件不存在,点击创建。然后在新加一行 dlv.path=C:/Go/bin/dlv.exe 重启就可以了, 注意是 / 不是 \


    image.png

    相关文章

      网友评论

          本文标题:goland debug运行报错问题

          本文链接:https://www.haomeiwen.com/subject/zfihdktx.html