golang使用goimports自动包含标准库 GoSublime安装

安装Package Control,不安装也行,可以手动安装GoSublime
https://packagecontrol.io/installation

手动安装GoSublime
https://packagecontrol.io/packages/GoSublime
git clone https://github.com/DisposaBoy/GoSublime

只对标准包有效
https://godoc.org/golang.org/x/tools/cmd/goimports
http://goinbigdata.com/goimports-vs-gofmt/

goimport does everything that gofmt do. 
Additionally it groups and corrects imported packages. 
While correcting, goimports removes unused imports and adds missing ones.

# 这里就不解释为什么需要设置http_proxy了
# 测试过程中发现sock5不被支持
# 于是先通过github.com/icexin/sockhttp将sock5代理转成http/https代理

先运行sockhttp
sockhttp -sock "127.0.0.1:1082" -listen ":7001"
然后
export http_proxy=http://127.0.0.1:7001
export https_proxy=https://127.0.0.1:7001
go get golang.org/x/tools/cmd/goimports
GoSublime设置 https://michaelwhatcott.com/gosublime-goimports/ Preferences > Package settings > GoSublime > Settings Default 找到"fmt_cmd": []修改为 "fmt_cmd": ["goimports"]


发表于:2017-11-28 08:36:10

原文链接(转载请保留): http://www.multisilicon.com/blog/a22254352.html

友情链接: MICROIC
首页