VScode安装golang插件详细教程

可能是由于非科班自学编程,所以在安装插件的时候虽然参考了很多人写的教程,但是总安装不成功,在综合各位大牛的教程之后进行总结,并且亲自实践安装成功,希望能给初学编程的人一些帮助,如果有不对的地方还希望大家指正。

注意:安装前提是必须配置好go语言环境,安装VScode及其go插件,git软件!!!

  • 第一步:通过快捷键【ctrl+shift+p】调出安装界面。
  • 第二步:输入或者点击【GO:install/Update Tools】,到此步骤时,部分插件会安装失败。
  • 第三步:进入到%GOPATH%\src\目录,通过如下命令下载源码。运行下面命令后会在src目录下自动生成github.com文件夹,并将相关插件源码下载到该目录下。
go get -u -v github.com/mdempsky/gocode
go get -u -v github.com/uudashr/gopkgs/cmd/gopkgs
go get -u -v github.com/ramya-rao-a/go-outline
go get -u -v github.com/acroca/go-symbols
go get -u -v golang.org/x/tools/cmd/guru
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v github.com/go-delve/delve/cmd/dlv
go get -u -v github.com/stamblerre/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/sqs/goreturns
go get -u -v golang.org/x/lint/golint
go get -u -v github.com/cweill/gotests/...
go get -u -v github.com/fatih/gomodifytags
go get -u -v github.com/josharian/impl
go get -u -v github.com/davidrjenni/reftools/cmd/fillstruct
go get -u -v github.com/haya14busa/goplay/cmd/goplay
go get -u -v github.com/godoctor/godoctor
  • 第四步:通过git下载lint跟toos源码,首先在自己的GOPATH的src目录下新建GOPATH/golang.org/x目录,然后cd到GOPATH/src/golang.org/x目录下,执行下述命令。会在GOPATH/golang.org/x目录下下载lint跟tools两个文件夹。
git clone https://github.com/golang/tools.git tools
git clone https://github.com/golang/lint.git
  • 第五步:cd到GOPATH目录执行下述命令,会在GOPATH/bin目录下自动生成16个可执行文件,然后将该16个可执行文件拷贝到GOROOT/bin目录下即可。
go install github.com/mdempsky/gocode
go install github.com/uudashr/gopkgs/cmd/gopkgs
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/cweill/gotests/...
go install github.com/fatih/gomodifytags
go install github.com/josharian/impl
go install github.com/davidrjenni/reftools/cmd/fillstruct
go install github.com/haya14busa/goplay/cmd/goplay
go install github.com/godoctor/godoctor
go install github.com/go-delve/delve/cmd/dlv
go install github.com/stamblerre/gocode
go install github.com/rogpeppe/godef
go install github.com/sqs/goreturns
go install golang.org/x/lint/golint
上一篇:VSCode安装jshint插件报错


下一篇:vsCode安装todo插件