1 Star 0 Fork 0

lonely/gometalinter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 866 Bytes
一键复制 编辑 原始数据 按行查看 历史
Leigh McCulloch 提交于 2018-09-09 04:13 . Update gochecknoglobals
package main // import "4d63.com/gochecknoglobals"
import (
"flag"
"fmt"
"os"
)
func main() {
flagPrintHelp := flag.Bool("h", false, "Print help")
flagIncludeTests := flag.Bool("t", false, "Include tests")
flag.Usage = func() {
fmt.Fprintf(os.Stderr, "Usage: gochecknoglobals [-t] [path] [path] ...\n")
flag.PrintDefaults()
}
flag.Parse()
if *flagPrintHelp {
flag.Usage()
return
}
includeTests := *flagIncludeTests
paths := flag.Args()
if len(paths) == 0 {
paths = []string{"./..."}
}
exitWithError := false
for _, path := range paths {
messages, err := checkNoGlobals(path, includeTests)
for _, message := range messages {
fmt.Fprintf(os.Stdout, "%s\n", message)
exitWithError = true
}
if err != nil {
fmt.Fprintf(os.Stderr, "error: %s\n", err)
exitWithError = true
}
}
if exitWithError {
os.Exit(1)
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lonely0422/gometalinter.git
git@gitee.com:lonely0422/gometalinter.git
lonely0422
gometalinter
gometalinter
v2.0.11

搜索帮助

0d507c66 1850385 C8b1a773 1850385