1.vs代码安装go所有插件vs代码版本:1.51.0
go版本: version go1.15.2 windows/amd64
git客户端版本: git-2.29.2.2-64位
2 .使用vscode自动安装之前,必须先安装go、vscode和git客户端,然后配置git环境和配置go环境。 名为GOPATH的环境变量对下面的安装很重要
根据go工程目录的要求(go很奇怪,工程目录有限制) ),不太了解的朋友可以在这个博客https://www.cn blogs.com/zsy/p/5262632.html
整理后,如果用vscode加载GOPATH目录,在src目录下创建测试文件,并使用. go扩展名,vscode将自动弹出安装go的插件。 前提是在vscode上安装了go扩展
这样,您可以通过在此扩展的位置搜索go插件来安装它
自动弹出的go插件安装屏幕如下所示。 点击那个安装全部就可以了
他需要安装以下插件。
gopkgs
几何轮廓
go-symbols
寡头
gorename
gotests
gomodifytags
impl
文件结构
goplay
godoctor
dlv
gocode-gomod
godef
goreturns
但是我的安装都失败了:
别慌! ! 这点问题还是很难打倒国民的,请看下面
3 .问题解决方案必须从github上手动下载软件包
在src目录下创建两个目录
src
|golang.org
--- |x
|github.com
某些软件包必须位于github.com中,其他软件包必须位于名为golang.orgx的文件夹中
一个一个下载软件包
gopkgs包
在src的gitbub.com文件夹下,使用cmd命令窗口输入。 请务必按照这个文件目录生成。 不这样做的话就安装不了。
git clone https://github.com/uudashr/go pkgs.gituudashr/go pkgs
安装此软件包需要另外两个子软件包。
git clone https://github.com/pkg/errors pkg/errors
git clone https://github.com/kar Rick/godirwalk.gitkarrick/godirwalk
下载上面的两个子包后,就可以安装了
可以通过输入以下命令,使用任意目录中的cmd命令行窗口进行安装:
goinstallgithub.com/uudashr/go pkgs/v2/cmd/go pkgs
安装完成后,将在src对等方的jjdggx目录下生成gocode.exe
地理空间包
在github.com目录下,使用以下命令下载软件包:
git clone https://github.com/ramya-Rao-a/go-outline.gitramya-Rao-a/go-outline
安装:(在任意目录下,下同)
goinstallgithub.com/ramya-Rao-a/go-outline
go-symbols包
下载:github.com目录下
git clone https://github.com/AC roca/go-symbols.gitacroca/go-symbols
安装:
oinstall github.com/AC roca/go-symbols
安装完成后,将在jjdggx下生成go-symbols.exe
guru,gorename包
这两个包在一个叫tools的大包里。 我们下载这个包。 这个很大,下载很慢
下载:golang.org/x目录下,没有x这个目录是新做的。 这是字母x,不
是指代git clone https://github.com/golang/tools.git tools
这个的安装也需要辅助包:
git clone https://github.com/golang/xerrors.git xerrors (在golang.org/x目录下)
git clone https://github.com/golang/mod.git mod(在golang.org/x目录下)
安装:
go install golang.org/x/tools/cmd/guru
go install golang.org/x/tools/cmd/gorename
在jjdggx目录下面会出现guru.exe、gorename.exe
gotests包
下载:在github.com目录下面,这个有点慢
git clone https://github.com/cweill/gotests.git cweill/gotests
安装:
go install github.com/cweill/gotests
gomodifytags包
下载:在github.com目录下面
git clone https://github.com/fatih/gomodifytags.git fatih/gomodifytags
这个也需要辅助包:在github.com目录下面
git clone https://github.com/fatih/structtag.git fatih/structtag
git clone https://github.com/fatih/yjddyl.git fatih/yjddyl
安装:
go install github.com/fatih/gomodifytags
在jjdggx下会出现一个gomodifytags.exe
impl包
下载:在github.com目录下面
git clone https://github.com/josharian/impl.git josharian/impl
安装:
go install github.com/josharian/impl
在jjdggx下会出现impl.exe
fillstruct包
下载:在github.com目录下面,这个有点慢
git clone https://github.com/davidrjenni/reftools.git davidrjenni/reftools
安装:
go install github.com/davidrjenni/reftools/cmd/fillstruct
在jjdggx下会出现fillstruct.exe
goplay包
下载:在github.com目录下面
git clone https://github.com/无辜的老虎14busa/goplay 无辜的老虎14busa/goplay
这个需要辅助包:在github.com目录下面
git clone https://github.com/skratchdot/open-golang.git skratchdot/open-golang
安装:
go install github.com/无辜的老虎14busa/goplay/cmd/goplay
在jjdggx目录下面会出现goplay.exe
godoctor包
下载:在github.com目录下面,这个有点慢
git clone https://github.com/godoctor/godoctor.git godoctor/godoctor
安装:
go install github.com/godoctor/godoctor
在jjdggx目录下会出现godoctor.exe
dlv包
下载:在github.com目录下面,这个有点慢
git clone https://github.com/go-delve/delve.git go-delve/delve
安装:
go install github.com/go-delve/delve/cmd/dlv
会在jjdggx目录下面生成dlv.exe
gocode-gomod包
下载:在github.com目录下面,这个有点慢
git clone https://github.com/stamblerre/gocode.git stamblerre/gocode
安装:
go install github.com/stamblerre/gocode
在jjdggx目录下面会出现gocode-gomod.exe
godef包
下载:在github.com目录下面,这个有点慢
git clone https://github.com/rogpeppe/godef.git rogpeppe/godef
安装:
go install github.com/rogpeppe/godef
在jjdggx目录下面会出现godef.exe文件
goreturns包
下载:在github.com目录下面,这个有点慢
git clone https://github.com/sqs/goreturns.git sqs/goreturns
安装:
go install github.com/sqs/goreturns
在jjdggx目录下会生成goreturns.exe
lint包
下载:在golang.org/x目录下面
git clone https://github.com/golang/lint.git lint
安装:
go install golang.org/x/lint/golint
在jjdggx下面会出现golint.exe
over~~,这篇写了2小时!!
相同的内容在下面的公众号中也有发布,每天分享一些编程知识与技巧,感兴趣的朋友可以加关注,感谢支持!!