ubuntu 下配置 golang + vscode开发环境,解决 golang 插件依赖安装失败问题

govscode 的安装、环境变量的配置,请参考前一篇文章 https://mp.csdn.net/postedit/100578467

Ubuntuvscode 中安装 golang 插件工具包时,提示好几个依赖工具包安装失败,失败的原因就不说了,都懂的。

下面讲如何解决依赖工具包安装失败的问题。

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

1、在 %GOPATH%/src/ 目录下,创建路径 golang.org/x,(ps:就是在 src 文件夹下建一个名为 goalng.org 的文件夹,然后在golang.org 文件下建一个名为x的文件夹)

2、打开终端,进入到 %GOPATH%/src/golang.org/x 下(就是用 cd 命令进入),执行以下命令下载需要安装工具包的源码

git clone https://github.com/golang/tools.git

clone 完成后,在 x 文件夹下会生成一个 tools 文件夹,至此,工具包所需要的源码已经准备好了。

3、下面,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/rogpeppe/godef

    go install github.com/sqs/goreturns

    go install github.com/cweill/gotests/gotests

4、对于 golint 这种包,只能单独手动 clone 后再 go install,具体做法为:

打开终端,cd 进入%GOPATH%/src/golang.org/x 后,执行

git clone https://github.com/golang/lint

下载完成 golint 需要的源码后,进入到 %GOPATH%下,执行

go install golang.org/x/lint/golint

至此,golint 就安装完成了。

5、下面,附上所有工具包的源码地址,只需要手动 git clone 后,再执行 go install 安装就行(需要注意路径的切换!!!)

    1   gocode https://github.com/mdempsky/gocode

    2   gopkgs https://github.com/uudashr/gopkgs

    3   go-outline https://github.com/ramya-rao-a/go-outline

    4   go-symbols https://github.com/acroca/go-symbols

    5   guru https://github.com/golang/tools

    6   gorename https://github.com/golang/tools

    7   dlv https://github.com/go-delve/delve

    8   gocode-gomod https://github.com/stamblerre/gocode

    9   godef https://github.com/rogpeppe/godef

    10 goreturns https://github.com/sqs/goreturns

    11 golint https://github.com/golang/lint

    12 gotests https://github.com/cweill/gotests

    13 gomodifytags https://github.com/fatih/gomodifytags

    14 impl https://github.com/josharian/impl

    15 fillstruct https://github.com/davidrjenni/reftools

    16 goplay https://github.com/haya14busa/goplay

    17 godoctor https://github.com/godoctor/godoctor

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值