首页 > 编程语言 > 详细

go_02_vscode 安装 go 语言插件

时间:2021-04-28 22:22:52      阅读:42      评论:0      收藏:0      [点我收藏+]

TSSC_go-plugin_install_vscode

1.在 vscode 中安装 go 相关插件

  • 故障处理:Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs FAILED VS code中安装Go的插件失败

  • 参考

https://blog.netimed.cn/archives/go/20201111/319.html
https://blog.csdn.net/xiazhipeng1000/article/details/109584712

1.1.配置 go mod 代理

# 开启代理设置,Go-1.13 以上默认启用
go env -w GO111MODULE=on

# 设置代理
go env -w GOPROXY=https://goproxy.io,direct

1.2.自动安装 go 插件-在线安装-18个

  • 需要预先安装好 go 语言,并配置好环境变量 GOPATH
cd ~/go/
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/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/stamblerre/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/sqs/goreturns
  • 实例演示:查看常用的插件
?  go ll ~/go/bin/
总用量 122M
-rwxr-xr-x 1 zhaoshuai zhaoshuai  15M  4月 28 17:31 dlv
-rwxr-xr-x 1 zhaoshuai zhaoshuai 5.6M  4月 28 17:30 fillstruct
-rwxr-xr-x 1 zhaoshuai zhaoshuai 8.2M  4月 28 17:44 gocode
-rwxr-xr-x 1 zhaoshuai zhaoshuai 8.1M  4月 28 17:44 gocode-gomod
-rwxr-xr-x 1 zhaoshuai zhaoshuai 7.2M  4月 28 17:32 godef
-rwxr-xr-x 1 zhaoshuai zhaoshuai 7.1M  4月 28 17:30 godoctor
-rwxr-xr-x 1 zhaoshuai zhaoshuai 5.0M  4月 28 17:32 golint
-rwxr-xr-x 1 zhaoshuai zhaoshuai 3.3M  4月 28 17:29 gomodifytags
-rwxr-xr-x 1 zhaoshuai zhaoshuai 3.2M  4月 28 17:28 go-outline
-rwxr-xr-x 1 zhaoshuai zhaoshuai 4.3M  4月 28 17:27 gopkgs
-rwxr-xr-x 1 zhaoshuai zhaoshuai 6.5M  4月 28 17:30 goplay
-rwxr-xr-x 1 zhaoshuai zhaoshuai  22M  4月 28 17:37 gopls
-rwxr-xr-x 1 zhaoshuai zhaoshuai 5.0M  4月 28 17:29 gorename
-rwxr-xr-x 1 zhaoshuai zhaoshuai 6.3M  4月 28 17:32 goreturns
-rwxr-xr-x 1 zhaoshuai zhaoshuai 3.1M  4月 28 17:28 go-symbols
-rwxr-xr-x 1 zhaoshuai zhaoshuai 8.4M  4月 28 17:28 guru
-rwxr-xr-x 1 zhaoshuai zhaoshuai 5.5M  4月 28 17:30 impl

1.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

cd golang.org/x/tools/cmd/guru
go install . && cd -

cd golang.org/x/tools/cmd/gorename
go install . && cd -

# 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
cd github.com/uudashr/gopkgs/v2/cmd/gopkgs
go install . && cd -

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

# go-symbols
git clone https://github.com/acroca/go-symbols.git github.com/acroca/go-symbols
cd github.com/acroca/go-symbols
go install . && cd -

# gotests
git clone https://github.com/cweill/gotests.git github.com/cweill/gotests
cd github.com/cweill/gotests
go install . && cd -

# 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
cd github.com/fatih/gomodifytags
go install . && cd -

# impl
git clone https://github.com/josharian/impl.git github.com/josharian/impl
cd github.com/josharian/impl
go install . && cd -

# fillstruct
git clone https://github.com/davidrjenni/reftools.git github.com/davidrjenni/reftools
cd github.com/davidrjenni/reftools/cmd/fillstruct
go install . && cd -

# 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
cd github.com/haya14busa/goplay/cmd/goplay
go install . && cd -

# godoctor
git clone https://github.com/godoctor/godoctor.git github.com/godoctor/godoctor
cd github.com/godoctor/godoctor
go install . && cd -

# dlv
git clone https://github.com/go-delve/delve.git github.com/go-delve/delve
cd github.com/go-delve/delve/cmd/dlv
go install . && cd -

# gocode-gomod
git clone https://github.com/stamblerre/gocode.git github.com/stamblerre/gocode
cd github.com/stamblerre/gocode
go install . && cd -

# godef
git clone https://github.com/rogpeppe/godef.git github.com/rogpeppe/godef
cd github.com/rogpeppe/godef
go install . && cd -

# goreturns
git clone https://github.com/sqs/goreturns.git github.com/sqs/goreturns
go install . && cd -
cd github.com/sqs/goreturns

# lint
git clone https://github.com/golang/lint.git golang.org/x/lint
cd golang.org/x/lint/golint
go install . && cd -
  • 完毕,呵呵呵

go_02_vscode 安装 go 语言插件

原文:https://www.cnblogs.com/tssc/p/14715447.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!