go插件 vscode 报错_手动设置 VS code Go 语言插件

VS Code 安装了Go插件以后,还需要安装一些辅助的插件但是呢 如果系统安装基本上都是失败。google 的访问被限制的缘故吧。网上找了一些文章 都或多或少的有那么点缺陷,安装的时候报错挺让人抓狂的。于是乎自己看着别人的文章 整了半天终于把这些东西手动安装上了,记录一下。

VSCode里面 Shift+Alt+P 调出下面这个命令框 然后输入Go:Install/Update Tools 之后就会显示出你需要安装的插件。

eef9ad573d116dad3074a15d9f46cbd2.png

像下面这个样子还挺多的都打上勾然后点确定让系统自己安装。也不用着急基本上都显示

e4e4c36d1ff533fa63623f475dc90602.png

FAILED,这个没事我们需要获得系统的输出来手动安装所以等着都显示完,基本上像下面这个样子

go.toolsGopath setting is not set. Using GOPATH D:workshopgo
Installing 17 tools at D:workshopgobin in module mode.
gocode
gopkgs
go-outline
go-symbols
guru
gorename
gotests
gomodifytags
impl
fillstruct
goplay
godoctor
dlv
gocode-gomod
godef
goreturns
golint
Installing http://github.com/mdempsky/gocode FAILED
Installing http://github.com/uudashr/gopkgs/v2/cmd/gopkgs FAILED
Installing http://github.com/ramya-rao-a/go-outline FAILED
Installing http://github.com/acroca/go-symbols FAILED
Installing http://golang.org/x/tools/cmd/guru FAILED
Installing http://golang.org/x/tools/cmd/gorename FAILED
Installing http://github.com/cweill/gotests/... FAILED
Installing http://github.com/fatih/gomodifytags FAILED
Installing http://github.com/josharian/impl FAILED
Installing http://github.com/davidrjenni/reftools/cmd/fillstruct FAILED
Installing http://github.com/haya14busa/goplay/cmd/goplay FAILED
Installing http://github.com/godoctor/godoctor FAILED
Installing http://github.com/go-delve/delve/cmd/dlv FAILED
Installing http://github.com/stamblerre/gocode FAILED
Installing http://github.com/rogpeppe/godef FAILED
Installing http://github.com/sqs/goreturns FAILED
Installing http://golang.org/x/lint/golint FAILED

基本的手动思路就是

1.github 上找到对应的地址并clone 到本地。比如http://github.com/davidrjenni/reftools/cmd/fillstruct 这个

2.放到本地的指定目录src里面 目录关系就是按照地址的这个顺序 src/http://github.com/davidrjenni/reftools/cmd/fillstruct

3.打开终端 进入bin目录,输入go install github.com/davidrjenni/reftools/cmd/fillstruct

5fce875f65c5132372c9c5862ea7a44f.png

install 后面这个地址必须跟你src里面地址一致,不然就会报错。

4.然后就是等着结果了如果成功就什么都不显示 在bin目录里面会生成一个fillstruct.exe的程序,失败的话会有提示出来。

总结一下遇到的坑:

1.就是github clone之后没有放到合适的目录里面这样编译的时候找不到文件这个错误我出来好多次。

2.有几个模块编译的时候是需要其他模块的这个还是要从github上 clone出来放到指定目录。3.go install的时候 要注意 Installing http://github.com/uudashr/gopkgs/v2/cmd/gopkgs 这个是之前报错的那个信息 我们执行的时候就是执行 http://github.com/uudashr/gopkgs/v2/cmd/gopkgs这一串。

4.比如我们要github clone http://github.com/davidrjenni/reftools这个的时候 我是先在src目录下新建个http://github.com 目录 然后新建 davidrjenni目录 然后进入这个目录再执行 git clone davidrjenni/reftools 这样执行 go install的时候才能对的上。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值