INNER CODE UNIT · Go
collectCheckNames
deckhouse/deckhouse · dhctl/hack/gen_preflight_checks/main.go:60
func collectCheckNames(paths []string) []string {
fset := token.NewFileSet()
seen := make(map[string]struct{})
for _, path := range paths {
file, err := parser.ParseFile(fset, path, nil, 0)
if err != nil {
continue
}
ast.Inspect(file, func(n ast.Node) bool {
decl, ok := n.(*ast.GenDecl)
if !ok || decl.Tok != token.CONST {
return true
}
for _, spec := range decl.Specs {
vs, ok := spec.(*ast.ValueSpec)
if !ok || !isCheckNameType(vs.Type) {
continue