做者在使用chaincode進行智能合約開發的過程當中,使用Goland + Golang + win10_X64做爲開發環境:git
GoLand 2018.1.4 Build #GO-181.5087.39, built on May 24, 2018 Licensed to youBBS JRE: 1.8.0_152-release-1136-b39 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 10 10.0 go1.11.4 windows/amd64
但在調試的時候會發生以下錯誤:github
D:\golang\bin\go.exe test -c -tags nopkcs1 -o C:\Users\NewWang\AppData\Local\Temp\___TestBcoin_Init_in_github_com_utxo_chaincode.exe -gcflags "all=-N -l" github.com/utxo/chaincode #gosetup "E:\GoLand 2018.1.4\bin\runnerw.exe" D:\golang\bin\go.exe tool test2json -t C:\Users\NewWang\.GoLand2018.1\config\plugins\intellij-go\lib\dlv\windows\dlv.exe --listen=localhost:58370 --headless=true --api-version=2 --backend=default exec C:\Users\NewWang\AppData\Local\Temp\___TestBcoin_Init_in_github_com_utxo_chaincode.exe -- -test.v -test.run ^TestBcoin_Init$ #gosetup could not launch process: decoding dwarf section info at offset 0x0: too short
總結網絡上提出如下兩種解決方案:golang
go get -u -v github.com/derekparker/delve/cmd/dlv
命令去編譯新版本的dlv,而後在經過在 Help -- Edit Custom Properties 中添加: dlv.path=D:/gopath/bin/dlv.exe
,來更新dlv到與go適配的版本。可是第二種方式通過做者的實際測試是無效的,後通過多方檢索找到了真正的緣由:json
在1.10以上的版本中,當應用工程引入plugin的包後debugframe會丟失,致使dlv沒法使用。
解決方案:windows
https://youtrack.jetbrains.com/issue/GO-5446
https://github.com/golang/go/issues/23733api