1 Star 0 Fork 2

QunXiongZhuLu/kratos

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
utils.go 858 Bytes
一键复制 编辑 原始数据 按行查看 历史
音風 提交于 2019-09-27 19:32 +08:00 . 是我静香不够骚,还是你胖虎开始飘~
package main
import (
"fmt"
"strings"
"golang.org/x/tools/imports"
)
// GoImport Use golang.org/x/tools/imports auto import pkg
func GoImport(file string, bytes []byte) (res []byte, err error) {
options := &imports.Options{
TabWidth: 8,
TabIndent: true,
Comments: true,
Fragment: true,
}
if res, err = imports.Process(file, bytes, options); err != nil {
fmt.Printf("GoImport(%s) error(%v)", file, err)
res = bytes
return
}
return
}
// ConvertMethod checkout the file belongs to dao or not
func ConvertMethod(path string) (method string) {
switch {
case strings.Contains(path, "/dao"):
method = "d"
case strings.Contains(path, "/service"):
method = "s"
default:
method = ""
}
return
}
//ConvertHump convert words to hump style
func ConvertHump(words string) string {
return strings.ToUpper(words[0:1]) + words[1:]
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/QunXiongZhuLu/kratos.git
git@gitee.com:QunXiongZhuLu/kratos.git
QunXiongZhuLu
kratos
kratos
v0.6.2

搜索帮助