本以为Visual Studio Code 安装Golang插件很容易,确实容易。但是安装Golang插件需要的插件却很麻烦。
譬如调试需要用dlv,visual studio code可以自动下载需要的插件,如下所示:
gocode
go-outline
go-symbols
guru
gorename
dlv
godef
goreturns
但是各种报错,信息如下:
Installing github.com/nsf/gocode FAILED
Installing github.com/ramya-rao-a/go-outline FAILED
Installing github.com/acroca/go-symbols FAILED
Installing golang.org/x/tools/cmd/guru FAILED
Installing github.com/golang/lint/golint FAILED
......
guru:
Error: Command failed: C:\Go\bin\go.exe get -u -v golang.org/x/tools/cmd/guru
Fetching https://golang.org/x/tools/cmd/guru?go-get=1
https fetch failed: Get https://golang.org/x/tools/cmd/guru?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
golang.org\x\tools (download)
Fetching https://golang.org/x/tools/cmd/guru/serial?go-get=1
https fetch failed: Get https://golang.org/x/tools/cmd/guru/serial?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
......
于是各种查找安装dlv失败的解决办法,网上说的很简单,都是通过如下命令:
go get -u github.com/d