背景:
在升級GO版本到1.11後發現Goland的Debug報錯,如下:could not launch process: decoding dwarf section info at offset 0x0: too short。
原因:
Goland的dlv不是新版本,導致不能debug調試。
解決:
1、下載
* git clone https://github.com/go-delve/delve.git $GOPATH/src/github.com/go-delve/delve
* cd $GOPATH/src/github.com/go-delve/delve
* make install
參考:https://blog.csdn.net/foxlively/article/details/90697909
2、修改Goland的配置,Help->Edit Custom Properties中增加新版dlv的路徑配置:dlv.path=$GOPATH/bin/dlv
注意:$GOPATH爲你的gopath路徑,使用絕對路徑。
3、重啓Goland IDE。再次使用debug調試工具,就沒有問題了。