go - 02 VsCode插件安装

Go-VsCode 插件安装

问题

在安装go插件后,会自动更新很多依赖库文件,都是从Github更新下来,但是因为Github的文件中,多有应用go官网中的文件,导致,因为网络缘故,不能直接下载,导致安装失败,如下:

Installing 10 tools at /Users/lane/gospace/bin
gocode
gopkgs
go-outline
go-symbols
guru
gorename
dlv
godef
goreturns
golint
Installing github.com/mdempsky/gocode SUCCEEDED
Installing github.com/uudashr/gopkgs/cmd/gopkgs > SUCCEEDED
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 golang.org/x/tools/cmd/gorename FAILED
Installing github.com/derekparker/delve/cmd/dlv > SUCCEEDED
Installing github.com/rogpeppe/godef SUCCEEDED
Installing github.com/sqs/goreturns FAILED
Installing github.com/golang/lint/golint FAILED

小提示:github下载速度较慢时可以通过修改dns改进。

  1. 通过http://tool.chinaz.com/dns查询github.com的dns ip地址
  2. 更改hosts文件加入ip地址与域名的对应。
    mac os 编辑hosts文件:sudo vi /etc/hosts
    mac os 10.12以上刷新DNS:sudo killall -HUP mDNSResponder

解决办法

第一步:手动从github下载golang.org/x/tools包

cd $GOPATH/src
mkdir -p golang.org/x
cd golang.org/x
git clone https://github.com/golang/tools.git tools
git clone https://github.com/golang/lint.git lint

第二步:手动执行 go install 安装失败包

cd $GOPATH 
go install github.com/ramya-rao-a/go-outline
go install github.com/acroca/go-symbols
go install golang.org/x/tools/cmd/guru
go install golang.org/x/tools/cmd/gorename
go install github.com/sqs/goreturns
go install github.com/golang/lint/golint

以上,搞定。macos High Sierra 10.13.4 亲测可行!!!

欢迎转载,请注明出处!

你可能感兴趣的:(go)