當我興致勃勃的開始 go 語言的 hello world 的時候, 驀然回首git
package main
import "fmt"
func main() {
var i = 1
fmt.Println("hello world ", i)
}
複製代碼
卻發現, 居然不能 debug....github
could not launch process: EOF
Process exiting with code: 1
複製代碼
CommandLineTools
更新後的問題.感謝Nob東瓜提供,用新版的 dlv 替換 idea 提供的舊版的(舊版dlv bug致使的,編譯最新的dlv替換idea自帶的便可).golang
dlv
項目地址github.com/derekparker… 2.安裝最新的 dlv.go get -v -u github.com/derekparker/delve/cmd/dlv
cd $GOPATH/src/github.com/derekparker/delve
make install
複製代碼
完成後bash
➜ delve git:(master) make install
scripts/gencert.sh || (echo "An error occurred when generating and installing a new certificate"; exit 1)
go install -ldflags="-s -X main.Build=9a216211d3461ab031f822c012bc27cab9758da0" github.com/derekparker/delve/cmd/dlv
codesign -s "dlv-cert" /usr/local/Cellar/go/1.10.3/libexec/bin/dlv
複製代碼
cd '/Users/{user}/Library/Application Support/IntelliJIdea2017.2/intellij-go/lib/dlv/mac'
mv dlv dlv_back
ln -s $GOROOT/bin/dlv dlv
複製代碼
$GOROOT/bin/dlv
指向的文件就是/usr/local/Cellar/go/1.10.3/libexec/bin/dlv
app
若是你用的 Goland 一樣的道理ide
cd /Applications/GoLand.app/Contents/plugins/intellij-go-plugin/lib/dlv/mac
mv dlv dlv_back
ln -s $GOROOT/bin/dlv dlv
複製代碼
ps:貌似有些 goland 的路徑在/Applications/GoLand.app/Contents/plugins/go/lib/dlv/mac
,本身試下就能夠啦工具
哦了ui
CommandLineTools
sudo rm -rf /Library/Developer/CommandLineTools
複製代碼
API server listening at: 127.0.0.1:50661
hello world 1
Debugger finished with exit code 0
複製代碼
參考:google