VSCode必装Go语言以下插件的思路详解
作者:袁俊亮技术博客 时间:2024-04-30 09:53:42
VSCode 必须安装以下插件:
首先你必须安装 Golang 插件,然后再给 Go 安装工具包。
在 VS Code 中,使用快捷键: command+shift+P
,然后键入: go:install/update tools
,将所有 16 个插件都勾选上,然后点击 OK 即开始安装。
Installing 16 tools at /Users/maiyang/develop/goworkspace//bin
gocode
gopkgs
go-outline
go-symbols
guru
gorename
dlv
godef
godoc
goreturns
golint
gotests
gomodifytags
impl
fillstruct
goplay
Installing github.com/mdempsky/gocode SUCCEEDED
Installing github.com/uudashr/gopkgs/cmd/gopkgs SUCCEEDED
Installing github.com/ramya-rao-a/go-outline SUCCEEDED
Installing github.com/acroca/go-symbols SUCCEEDED
Installing golang.org/x/tools/cmd/guru SUCCEEDED
Installing golang.org/x/tools/cmd/gorename SUCCEEDED
Installing github.com/derekparker/delve/cmd/dlv SUCCEEDED
Installing github.com/rogpeppe/godef SUCCEEDED
Installing golang.org/x/tools/cmd/godoc SUCCEEDED
Installing github.com/sqs/goreturns SUCCEEDED
Installing github.com/golang/lint/golint SUCCEEDED
Installing github.com/cweill/gotests/... SUCCEEDED
Installing github.com/fatih/gomodifytags SUCCEEDED
Installing github.com/josharian/impl SUCCEEDED
Installing github.com/davidrjenni/reftools/cmd/fillstruct SUCCEEDED
Installing github.com/haya14busa/goplay/cmd/goplay SUCCEEDED
All tools successfully installed. You're ready to Go :).
修改默认配置的方法:
在 Preferences -> Setting
然后输入 go,然后选择 setting.json
,填入你想要修改的配置
自动完成未导入的包。
"go.autocompleteUnimportedPackages": true,
VSCode 的一些插件需要配置代理,才能够正常安装。(配合VPN一起使用)
"http.proxy": "192.168.0.100:1087",
如果你遇到使用标准包可以出现代码提示,但是使用自己的包或者第三方库无法出现代码提示,你可以查看一下你的配置项。
"go.inferGopath": true,
如果引用的包使用了 ( . “aa.com/text”) 那这个text包下的函数也无法跳转进去,这是为什么?
修改 "go.docsTool
" 为 gogetdoc ,默认是 godoc。
"go.docsTool": "gogetdoc",
其他
当我们在使用 import 功能的时候,如果无法通过 lint 检查,则不会执行自动 import。
如果你需要自动 import 的前提是你必须把要导入的包的函数写完整。
附带我的 settings.json
{
"go.goroot": "",
"go.gopath": "",
"go.inferGopath": true,
"go.autocompleteUnimportedPackages": true,
"go.gocodePackageLookupMode": "go",
"go.gotoSymbol.includeImports": true,
"go.useCodeSnippetsOnFunctionSuggest": true,
"go.useCodeSnippetsOnFunctionSuggestWithoutType": true,
"go.docsTool": "gogetdoc",
}
参考文章: https://maiyang.me/post/2018-09-14-tips-vscode/
来源:https://studygolang.com/articles/27577
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python 利用jieba.analyse进行 关键词提取
![](https://img.aspxhome.com/file/2023/5/78575_0s.png)
MySQL Order By Rand()效率
python读取json文件并将数据插入到mongodb的方法
cmd运行python文件时对结果进行保存的方法
![](https://img.aspxhome.com/file/2023/5/92185_0s.jpg)
go语言日志记录库简单使用方法实例分析
如何基于Python + requests实现发送HTTP请求
MySQL故障切换笔记之应用无感知设计详解
HTTP状态码
sql与mysql有哪些区别
eWebEditor在线HTML编辑助手下载及安装使用说明
![](https://img.aspxhome.com/file/UploadPic/200810/11/20081011142410220s.gif)
Vue $emit()不能触发父组件方法的原因及解决
Golang实现http重定向https
opencv python图像梯度实例详解
![](https://img.aspxhome.com/file/2023/2/124692_0s.png)
利用python GDAL库读写geotiff格式的遥感影像方法
python sys模块使用方法介绍
![](https://img.aspxhome.com/file/2023/5/112435_0s.png)
ubuntu下设置mysql自动备份的例子
python 如何利用chinese_calendar 获取上一个工作日日期
![](https://img.aspxhome.com/file/2023/2/78762_0s.png)
CSS Border使用小分享
![](https://img.aspxhome.com/file/UploadPic/20108/12/box-model-47s.png)