解决golang windows调试问题:Could not determine version number: could not find symbol value for runtime.buildVersion

版本信息:
go:1.8.3
windows: win7/64
idea-go-plugin:171.4694.61

在windows下,使用dlv进行调试的时候,如果golang程序引入了c模块,比如常用的sqlite模块,那么在调试的时候一定会发生这个错误:
· Could not determine version number: could not find symbol value for runtime.buildVersion·

现在这个问题已经解决了,解决方法就是go build 的时候加入-ldflags="-linkmode internal" ,这样就可以正常调试了。
如果用的是gogland ide,或者jetbrains其他ide,安装了golang插件,那么在Run/Debug Configurations时,可以在Go Tool arguments中加入
·-ldflags="-linkmode internal"·

具体见下图:
gogland配置

原文地址:https://www.cnblogs.com/baizx/p/7182066.html