当前位置:   article > 正文

一招完美解决vscode安装go插件失败问题_vscode go插件 server return 404

vscode go插件 server return 404

vscode 安装go插件

前置

  • https://studygolang.com/dl下载go1.14.6.windows-amd64.msi安装即可,安装路径选择默认,安装完成后会自动帮你配置环境变量不用自己配置了
  • 打开cmd,查看是否安装完成
    在这里插入图片描述
    这样就代表已经成功安装了

用vscode新建一个go文件

在这里插入图片描述

  • vscode会提示你安装go插件
  • 点击install all
  • 这时候会安装失败
    Installing github.com/mdempsky/gocode FAILED
    Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs FAILED
    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/cweill/gotests/… FAILED
    Installing github.com/fatih/gomodifytags FAILED
    Installing github.com/josharian/impl FAILED
    Installing github.com/davidrjenni/reftools/cmd/fillstruct FAILED
    Installing github.com/haya14busa/goplay/cmd/goplay FAILED
    Installing github.com/godoctor/godoctor FAILED
    Installing github.com/go-delve/delve/cmd/dlv FAILED
    Installing github.com/stamblerre/gocode FAILED
    Installing github.com/rogpeppe/godef FAILED
    Installing github.com/sqs/goreturns FAILED
    Installing golang.org/x/lint/golint FAILED

原因你懂的

使用go mod 代理来安装

https://goproxy.io是一个国内的代理
执行

  1. go env -w GO111MODULE=on
  2. go env -w GOPROXY=https://goproxy.io,direct
  • 1
  • 2

关闭vscode重新打开,再次点击install all

在这里插入图片描述
成功安装

开启go mod 代理后也可以手动安装

  1. go get -u -v github.com/mdempsky/gocode
  2. go get -u -v github.com/uudashr/gopkgs/v2/cmd/gopkgs
  3. go get -u -v github.com/ramya-rao-a/go-outline
  4. go get -u -v github.com/acroca/go-symbols
  5. go get -u -v golang.org/x/tools/cmd/guru
  6. go get -u -v golang.org/x/tools/cmd/gorename
  7. go get -u -v github.com/cweill/gotests/...
  8. go get -u -v github.com/fatih/gomodifytags
  9. go get -u -v github.com/josharian/impl
  10. go get -u -v github.com/davidrjenni/reftools/cmd/fillstruct
  11. go get -u -v github.com/haya14busa/goplay/cmd/goplay
  12. go get -u -v github.com/godoctor/godoctor
  13. go get -u -v github.com/go-delve/delve/cmd/dlv
  14. go get -u -v github.com/stamblerre/gocode
  15. go get -u -v github.com/rogpeppe/godef
  16. go get -u -v github.com/sqs/goreturns
  17. go get -u -v golang.org/x/lint/golint
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

如图
在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/177902
推荐阅读
相关标签
  

闽ICP备14008679号