go-install-02-go模块插件安装

go-install-02-go模块插件安装

  • 需要预先配置好加速代理

2.安装 go 模块插件

2.1.使用 vscode 在线安装 go 插件

  • 快捷键 ctrl+shift+P 打开命令控制器
输入 go: install
选择 update tools,然后选择所有插件进行安装

2.2.在线安装 go 插件

  • 终端命令行安装 go 的插件
cd ~/go/
go get -u -v golang.org/x/tools/cmd/godoc
go get -u -v golang.org/x/tools/cmd/goformat
go get -u -v golang.org/x/tools/cmd/goimports
go get -u -v golang.org/x/tools/cmd/goreturns
go get -u -v golang.org/x/tools/cmd/guru
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v golang.org/x/tools/gopls
go get -u -v golang.org/x/lint/golint
#go get -u -v github.com/mdempsky/gocode
go get -u -v github.com/stamblerre/gocode
go get -u -v github.com/uudashr/gopkgs/v2/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 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
go get -u -v github.com/go-delve/delve/cmd/dlv
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/sqs/goreturns

2.3.离线安装 go 插件

  • 也可以先从 github 上将安装包下载到本地在进行安装
# 创建指定的目录结构
cd ~/go/
mkdir -p bin
mkdir -p src/github.com/golang
mkdir -p src/golang.org/x
cd ~/go/src

# 下载 tools 包,安装 guru,gorename,下载比较慢,注意下载路径
git clone https://github.com/golang/xerrors.git golang.org/x/xerrors
git clone https://github.com/golang/mod.git golang.org/x/mod
git clone https://github.com/golang/tools.git golang.org/x/tools
go install golang.org/x/tools/cmd/guru@latest
go install golang.org/x/tools/cmd/gorename@latest

# lint,注意下载路径
git clone https://github.com/golang/lint.git golang.org/x/lint
go install golang.org/x/lint/golint@latest

# gopkgs,注意下载路径
git clone https://github.com/pkg/errors github.com/pkg/errors
git clone https://github.com/karrick/godirwalk.git github.com/karrick/godirwalk
git clone https://github.com/uudashr/gopkgs.git github.com/uudashr/gopkgs
go install github.com/uudashr/gopkgs/v2/cmd/gopkgs@latest

# go-outline
git clone https://github.com/ramya-rao-a/go-outline.git github.com/ramya-rao-a/go-outline
go install github.com/ramya-rao-a/go-outline@latest

# go-symbols
git clone https://github.com/acroca/go-symbols.git github.com/acroca/go-symbols
go install github.com/acroca/go-symbols@latest

# gotests
git clone https://github.com/cweill/gotests.git github.com/cweill/gotests
go install github.com/cweill/gotests@latest

# gomodifytags
git clone https://github.com/fatih/structtag.git github.com/fatih/structtag
git clone https://github.com/fatih/camelcase.git github.com/fatih/camelcase
git clone https://github.com/fatih/gomodifytags.git github.com/fatih/gomodifytags
go install github.com/fatih/gomodifytags@latest

# impl
git clone https://github.com/josharian/impl.git github.com/josharian/impl
go install github.com/josharian/impl@latest

# fillstruct
git clone https://github.com/davidrjenni/reftools.git github.com/davidrjenni/reftools
go install github.com/davidrjenni/reftools/cmd/fillstruct@latest

# goplay
git clone https://github.com/skratchdot/open-golang.git github.com/skratchdot/open-golang
git clone https://github.com/haya14busa/goplay github.com/haya14busa/goplay
go install github.com/haya14busa/goplay/cmd/goplay@latest

# godoctor
git clone https://github.com/godoctor/godoctor.git github.com/godoctor/godoctor
go install github.com/godoctor/godoctor@latest

# dlv
git clone https://github.com/go-delve/delve.git github.com/go-delve/delve
go install github.com/go-delve/delve/cmd/dlv@latest

# gocode-gomod
git clone https://github.com/stamblerre/gocode.git github.com/stamblerre/gocode
go install github.com/stamblerre/gocode@latest

# godef
git clone https://github.com/rogpeppe/godef.git github.com/rogpeppe/godef
go install github.com/rogpeppe/godef@latest

# goreturns
git clone https://github.com/sqs/goreturns.git github.com/sqs/goreturns
go install github.com/sqs/goreturns@latest

10.参考地址

https://blog.netimed.cn/archives/go/20201111/319.html
https://blog.csdn.net/xiazhipeng1000/article/details/109584712
https://www.liwenzhou.com/posts/Go/00_go_in_vscode/
posted @ 2021-04-28 19:02  天生帅才  阅读(684)  评论(0编辑  收藏  举报
// 百度统计