Visual Code+Golang环境手工安装依赖

ponder4 · · 1122 次点击 · · 开始浏览    
这是一个创建于 的文章,其中的信息可能已经有所发展或是发生改变。

#01 综述

微软发布的visual code studio是款简单易用的轻量级IDE,支持众多语言,包括Go语言。
通过extensions:install extensions安装了Go语言支持插件后,还需要安装gopls、gocode等依赖,因为golang.org无法直接访问,所以有时需要通过GitHub下载后手工安装依赖。

#02 下载和安装

使用git clone指令下载源文件至对应的 src 目录下,使用go install进行安装。(需要保持src下的目录路径与安装时提交的路径参数一致,如使用go install golang.org/x/tools/cmd/guru,下载时存放路径应是 src\golang.org\x\tools\cmd\guru

#安装guru和gorename
git clone https://github.com/golang/tools.git "%GOPATH%\src\golang.org\x\tools"
go install golang.org/x/tools/cmd/guru
go install golang.org/x/tools/cmd/gorename
#安装golint
git clone https://github.com/golang/lint.git "%GOPATH%\src\golang.org\x\lint"
go install golang.org/x/lint/golint
#安装gopls
git clone https://github.com/sergi/go-diff.git "%GOPATH%\src\github.com\sergi\go-diff"
git clone https://github.com/golang/mod.git "%GOPATH%\src\golang.org\x\mod"
git clone https://github.com/golang/sync.git "%GOPATH%\src\golang.org\x\sync"
git clone https://github.com/golang/xerrors.git "%GOPATH%\src\golang.org\x\xerrors"
git clone https://github.com/dominikh/go-tools.git "%GOPATH%\src\honnef.co\go\tools"
git clone https://github.com/BurntSushi/toml.git "%GOPATH%\src\github.com\BurntSushi\toml"
git clone https://github.com/mvdan/xurls.git "%GOPATH%\src\github.com\mvdan\xurls"
#安装gocode
git clone https://github.com/mdempsky/gocode.git "%GOPATH%\src\github.com\mdempsky\gocode"
go install github.com/mdempsky/gocode
#安装go-outline
git clone https://github.com/ramya-rao-a/go-outline.git "%GOPATH%\src\github.com\ramya-rao-a\go-outline"
go install github.com/ramya-rao-a/go-outline
#安装gopkgs
git clone https://github.com/uudashr/gopkgs.git "%GOPATH%\src\github.com\uudashr\gopkgs"
git clone https://github.com/karrick/godirwalk.git "%GOPATH%\src\github.com\karrick\godirwalk"
git clone https://github.com/pkg/errors.git "%GOPATH%\src\github.com\pkg\errors"
go install github.com/uudashr/gopkgs/cmd/gopkgs
#安装go-symbols
git clone https://github.com/acroca/go-symbols.git "%GOPATH%\src\github.com\acroca\go-symbols"
go install github.com/acroca/go-symbols
#安装godef
git clone https://github.com/rogpeppe/godef.git "%GOPATH%\src\github.com\rogpeppe\godef"
go install github.com/rogpeppe/godef
#安装goreturns
git clone https://github.com/sqs/goreturns.git "%GOPATH%\src\github.com\sqs\goreturns"
go install github.com/sqs/goreturns

#03 安装完成

安装完成后,会在%GOPATH%\bin目录下,生成可执行文件:

go-outline.exe
go-symbols.exe
gocode.exe
godef.exe
golint.exe
gopkgs.exe
gopls.exe
gopls.exe~
gorename.exe
goreturns.exe
guru.exe

有疑问加站长微信联系(非本文作者)

本文来自:简书

感谢作者:ponder4

查看原文:Visual Code+Golang环境手工安装依赖

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

1122 次点击  
加入收藏 微博
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传