解决vscode中golang插件依赖安装失败问题

解决vscode中golang插件依赖安装失败问题

vscode中安装ms-vscode.go插件后可以开启对go语言的支持,ms-vscode.go插件需要依赖一些工具,安装完成后提示


Installing github.com/nsf/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/fatih/gomodifytags SUCCEEDED
Installing github.com/haya14busa/goplay/cmd/goplay SUCCEEDED
Installing github.com/josharian/impl FAILED
Installing github.com/rogpeppe/godef SUCCEEDED
Installing sourcegraph.com/sqs/goreturns FAILED
Installing golang.org/x/lint/golint FAILED
Installing github.com/cweill/gotests/... FAILED
Installing github.com/derekparker/delve/cmd/dlv SUCCEEDED
 
8 tools failed to install.

由于网络原因,一些依赖工具无法正常安装,需要进行手动安装.

以下为手动安装的工具的步骤:

  1. %GOPATH%\src\目录下,建立路径golang.org\x

  2. 进入到%GOPATH%\src\golang.org\x,下载需要工具的源码git clone https://github.com/golang/tools.git tools

  3. clone完成后,会生成一个tools文件夹,这样工具所需要的源码已经准备好了

  4. 进入到%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/rogpeppe/godef
    
        go install github.com/sqs/goreturns
    
        go install github.com/cweill/gotests/gotests
    
    
    
  5. 单独处理golint,golint的源码位于https://github.com/golang/lint,进入%GOPATH%\src\golang.org\x后执行git clone https://github.com/golang/lint下载golint需要的源码

  6. 进入到%GOPATH%下,执行go install github.com/golang/lint/golint

这样,vscode的golang插件所依赖的工具安装完成了。

    原文作者:volkin
    原文地址: https://www.jianshu.com/p/6293503522bc
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞