最新的版本:go version go1.20.4 windows/amd64
使用idea进行调试时提示报错,version of Delve is too old for Go version 1.20.0 (maximum supported version 1.19),然后调试就卡住了。
先说方法再说原因。
注意:我是使用的idea,没用GoLand,不过好像GoLand也有这个问题。
解决办法:
1、执行下面代码
go install github.com/go-delve/delve/cmd/dlv@latest
或者go install github.com/go-delve/delve/cmd/dlv也行
这一步完成后,你的gopath路径下会有这个文件
2、点击idea或者GoLand中的Help菜单,点击Edit Custom Properties
输入:dlv.path=gopath路径+dlv.exe
类似这样:C:\\Users\\xxx\\go\\bin\\dlv.exe
gopath路径看这里,默认首条
原因:
根据多方咨询,十有八九这是官方导致的错误。
GoLand的EAP版本已经修复了这个问题。
we updated Delve and it is available in EAP version and will be available in the next patch updates for 2022.3.
--Daniil Maslov