vscode安装dlv插件报错:There is no tracking information for the current branch.

时间:2022-03-06 06:19:50

vscode安装dlv插件报错:There is no tracking information for the current branch.

https://blog.csdn.net/a785975139/article/details/80874792
 

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

待所有文件下载完,再执行官方的安装命令:

go get -u github.com/derekparker/delve/cmd/dlv 

如果没有报错,那么就成功了,这时启动vscode验证下吧。

我是删除文件后直接运行就行了

go get -v -u github.com/peterh/liner github.com/derekparker/delve/cmd/dlv