分享
golang 系统包自动填写插件
zhangqingping · · 4935 次点击 · · 开始浏览这是一个创建于 的文章,其中的信息可能已经有所发展或是发生改变。
- Make sure
$GOPATH/binis in your$PATH(Windows:%GOPATH%\bingoes in your%PATH%). 【保证你的golang环境正常】 - Run
go get -u golang.org/x/tools/cmd/goimports(you may have to install mercurial). 【通过go下载工具】 - Install Sublime Text and GoSublime (or make sure you’ve got the latest update if it’s already installed). 【安装了sublime text 和 Gosublime插件】
- Open the gosublime user config/preference file (Mac:
⌘. ⌘5Windows:Ctrl+. Ctrl+5). Make sure you keep the command button down for the whole shortcut sequence. 【进行配置】 - Make it look like this:
{ "fmt_cmd": ["goimports"] }
然后,你在保存的时候,如果漏掉了系统import的包,就会自动帮你import。
个人感觉,copy的代码更需要这个。自己新写的代码,一般都会记得包含,因为不import对应的包, Gosublime就没办法进行函数的提示了。
有疑问加站长微信联系(非本文作者)
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
关注微信4935 次点击
添加一条新回复
(您需要 后才能回复 没有账号 ?)
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码` - 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传
收入到我管理的专栏 新建专栏
- Make sure
$GOPATH/binis in your$PATH(Windows:%GOPATH%\bingoes in your%PATH%). 【保证你的golang环境正常】 - Run
go get -u golang.org/x/tools/cmd/goimports(you may have to install mercurial). 【通过go下载工具】 - Install Sublime Text and GoSublime (or make sure you’ve got the latest update if it’s already installed). 【安装了sublime text 和 Gosublime插件】
- Open the gosublime user config/preference file (Mac:
⌘. ⌘5Windows:Ctrl+. Ctrl+5). Make sure you keep the command button down for the whole shortcut sequence. 【进行配置】 - Make it look like this:
{ "fmt_cmd": ["goimports"] }
然后,你在保存的时候,如果漏掉了系统import的包,就会自动帮你import。
个人感觉,copy的代码更需要这个。自己新写的代码,一般都会记得包含,因为不import对应的包, Gosublime就没办法进行函数的提示了。