zoukankan      html  css  js  c++  java
  • vscode安装go所有插件

    原文节选自https://blog.csdn.net/xiazhipeng1000/article/details/109584712

    备用以为后用

    时间很重要 

    最好使用SDK版本version go1.15.的   16会报错

    vscode版本:1.56.2

    go版本:version go1.15.2 windows/amd64

    git客户端版本:Git-2.29.2.2-64-bit

    需要提前安装go、vscode、git客户端,配置git环境,配置go环境,配置环境变量GOPATH  , GOROOT , PATH 。

    安装插件

    需要手动从github上面将包下载下来

    在src目录下面建立两个目录

    – src
    ​ |–golang.org
    ---- |–x
    ​ |–github.com

    有些包是需要放到github.com,有另外一部分是需要放到golang.orgx这个文件夹中的

    下面就一个一个的下载包

    gopkgs包

    在src的gitbub.com文件夹下,使用cmd命令窗口输入,一定要按照这个文件目录生成,要不然没有办法安装,

    git clone https://github.com/uudashr/gopkgs.git uudashr/gopkgs

    这个包的安装需要另外两个辅助包:

    git clone https://github.com/pkg/errors pkg/errors

    git clone https://github.com/karrick/godirwalk.git karrick/godirwalk

    下载完上面的两个辅助包,就可以进行安装了

    使用cmd命令行窗口(在任意目录下),输入下面的命令就可以安装了:

    go install github.com/uudashr/gopkgs/v2/cmd/gopkgs

    安装完成之后,在src同级的bin目录下会生成gocode.exe

    go-outline包

    在github.com目录下面,使用下面的命令下载包:

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

    安装:(在任意目录下面,下面都一样)

    go install github.com/ramya-rao-a/go-outline

    go-symbols包

    下载:在github.com目录下面

    git clone https://github.com/acroca/go-symbols.git acroca/go-symbols

    安装:

    go install github.com/acroca/go-symbols

    安装完成之后,在bin下会生成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

    在bin目录下面会出现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/camelcase.git fatih/camelcase

    安装:

    go install github.com/fatih/gomodifytags

    在bin下会出现一个gomodifytags.exe

    impl包

    下载:在github.com目录下面

    git clone https://github.com/josharian/impl.git josharian/impl

    安装:

    go install github.com/josharian/impl

    在bin下会出现impl.exe

    fillstruct包

    下载:在github.com目录下面,这个有点慢

    git clone https://github.com/davidrjenni/reftools.git davidrjenni/reftools

    安装:

    go install github.com/davidrjenni/reftools/cmd/fillstruct

    在bin下会出现fillstruct.exe

    goplay包

    下载:在github.com目录下面

    git clone https://github.com/haya14busa/goplay haya14busa/goplay

    这个需要辅助包:在github.com目录下面

    git clone https://github.com/skratchdot/open-golang.git skratchdot/open-golang

    安装:

    go install github.com/haya14busa/goplay/cmd/goplay

    在bin目录下面会出现goplay.exe

    godoctor包

    下载:在github.com目录下面,这个有点慢

    git clone https://github.com/godoctor/godoctor.git godoctor/godoctor

    安装:

    go install github.com/godoctor/godoctor

    在bin目录下会出现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

    会在bin目录下面生成dlv.exe

    gocode-gomod包

    下载:在github.com目录下面,这个有点慢

    git clone https://github.com/stamblerre/gocode.git stamblerre/gocode

    安装:

    go install github.com/stamblerre/gocode

    在bin目录下面会出现gocode-gomod.exe

    godef包

    下载:在github.com目录下面,这个有点慢

    git clone https://github.com/rogpeppe/godef.git rogpeppe/godef

    安装:

    go install github.com/rogpeppe/godef

    在bin目录下面会出现godef.exe文件

    goreturns包

    下载:在github.com目录下面,这个有点慢

    git clone https://github.com/sqs/goreturns.git sqs/goreturns

    安装:

    go install github.com/sqs/goreturns

    在bin目录下会生成goreturns.exe

    lint包

    下载:在golang.org/x目录下面

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

    安装:

    go install golang.org/x/lint/golint

    在bin下面会出现golint.exe
    ————————————————
    版权声明:本文为CSDN博主「爱喝水的社长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/xiazhipeng1000/article/details/109584712

    一些问题

    1 如果clone失败多获取几次就好了

    2 报错“

    golang.org/x/tools/cmd/guru
    toolsgointernalcgocgo.go:67:2: cannot find package "golang.org/x/sys/execabs" in any of:


    执行下面命令

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

    3 配置gopls插件

    对于没有成功安装gopls(智能提示功能)的小伙伴,下面是具体的操作方式

    进入gopath cd %GOPATH%,接着一次执行

    go env -w GOPROXY=https://goproxy.io,direct
    go env -w GO111MODULE=on
    go get golang.org/x/tools/gopls@latest
    
    结束记得关闭
    go env -w GO111MODULE=off
    

      

  • 相关阅读:
    java获取当前项目或类路径
    java转义字符处理——“\”替换为“/”
    OpenModelica 在特定目录下生成仿真结果文件
    Eclipse常用设置
    java反编译器
    OMShell常用命令及遇到的问题
    Java中的单实例
    Eclipse常用设置
    Eclipse快捷键
    vlookup+match高亮显示行
  • 原文地址:https://www.cnblogs.com/starm/p/14821075.html
Copyright © 2011-2022 走看看