vscode安装go语言的调试插件,按官方给出的方法很简单,在cmd下执行这个命令:
go get -u github.com/derekparker/delve/cmd/dlv
无耐的是,我一直报如下错误:
go get -v -u -x github.com/derekparker/delve/cmd/dlv
github.com/derekparker/delve (download)
cd C:\Users\wangyiyin\go\src\github.com\derekparker\delve
git pull --ff-only
cd C:\Users\wangyiyin\go\src\github.com\derekparker\delve; git pull --ff-only
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> master
package github.com/derekparker/delve/cmd/dlv: exit status 1
经地自己一番摸索,终于找到了解决办法。我们先进入"%GOPATH%\src\github.com\derekparker"(没有这些目录的话就自己手动创建,GOPATH这个环境变量也要事先配置好),将dlv文件夹删除(没有这个文件夹就忽略),然后在当前目录下执行下面的命令将dlv项目拷贝下来:
git clone https://github.com/derekparker/delve.git
再将dlv文件夹复制一份到%GOPATH%\src\github.com\go-delve下
go install github.com/derekparker/delve/cmd/dlv
然后就OK了