ycmd第三方包golang.org/x/tools解决方案

vim安装YouCompleteMe插件时 , 碰到以下报错:

[gaoqilin@gqlmac /Users/gaoqilin/.vim/bundle/YouCompleteMe]$ git submodule update –init –recursive
Cloning into ‘/Users/gaoqilin/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/go/src/golang.org/x/tools’…

fatal: unable to access ‘ https://go.googlesource.com/tools/’
: Failed to connect to go.googlesource.com
port 443: Operation timed out

fatal: clone of ‘ https://go.googlesource.com/tools’
into submodule path ‘/Users/gaoqilin/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/go/src/ golang.org/x/tools’
failed
Failed to clone ‘third_party/go/src/golang.org/x/tools’. Retry scheduled
Cloning into ‘/Users/gaoqilin/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/go/src/golang.org/x/tools’…

解决方案 :

从github下载golang.org/x/tools https://github.com/golang/tools

第一步: 先替换 .git/config
文件`

vim ~/.vim/bundle/YouCompleteMe/third_party/ycmd/.git/config

找到 [submodule "third_party/go/src/golang.org/x/tools"]
替换为以下内容

[submodule "third_party/go/src/golang.org/x/tools"]
    active = true
    url = https://github.com/relunctance/tools.git

第二步: 替换 .gitmodules
文件

vim ~/.vim/bundle/YouCompleteMe/third_party/ycmd/.gitmodules

找到 [submodule "third_party/go/src/golang.org/x/tools"]
替换为以下内容

[submodule "third_party/go/src/golang.org/x/tools"]
    path = third_party/go/src/golang.org/x/tools
    url = https://github.com/relunctance/tools.git
    ignore = dirty

第三步

cd ~/.vim/bundle/YouCompleteMe/third_party/ycmd
git submodule update --init --recursive