天天看點

解決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"·

具體見下圖:

解決golang windows調試問題:Could not determine version number: could not find symbol value for runtime.buildVersion