1 Star 0 Fork 0

bughou / go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
pkg.go 475 Bytes
一键复制 编辑 原始数据 按行查看 历史
bughou 提交于 2022-03-21 20:37 . save
package pkgpkg
import (
"go/ast"
"go/token"
"gitee.com/go-better/dev/tool/gospec/rules/name"
)
var Pkg = Rule{
thing: "package",
key: "pkg",
Rule: name.Rule{
MaxLen: 30,
Style: "lower_case",
},
}
type Checker struct {
m map[string]bool
}
func NewChecker() Checker {
return Checker{m: make(map[string]bool)}
}
func (c Checker) Check(name *ast.Ident, fileSet *token.FileSet) {
if !c.m[name.Name] {
Pkg.check(name, fileSet)
c.m[name.Name] = true
}
}
Go
1
https://gitee.com/bughou/go.git
git@gitee.com:bughou/go.git
bughou
go
go
d31700df43a9

搜索帮助