cmd/promtool/main.go
func CheckConfig(files ...string) int {
	failed := false

	for _, f := range files {
		ruleFiles, err := checkConfig(f)
		if err != nil {
			fmt.Fprintln(os.Stderr, "  FAILED:", err)
			failed = true
		} else {
			fmt.Printf("  SUCCESS: %d rule files found\n", len(ruleFiles))
		}
		fmt.Println()

		for _, rf := range ruleFiles {
			if n, err := checkRules(rf); err != nil {
				fmt.Fprintln(os.Stderr, "  FAILED:", err)
				failed = true
			} else {
				fmt.Printf("  SUCCESS: %d rules found\n", n)
			}
			fmt.Println()
		}
	}
	if failed {
		return 1
	}
	return 0
}
func CheckConfig(files ...string) int {
	failed := false

	for _, f := range files {
		ruleFiles, err := checkConfig(f)
		if err != nil {
			fmt.Fprintln(os.Stderr, "  FAILED:", err)
			failed = true
		} else {
			fmt.Printf("  SUCCESS: %d rule files found\n", len(ruleFiles))
		}
		fmt.Println()

		for _, rf := range ruleFiles {
			if n, err := checkRules(rf); err != nil {
				fmt.Fprintln(os.Stderr, "  FAILED:", err)
				failed = true
			} else {
				fmt.Printf("  SUCCESS: %d rules found\n", n)
			}
			fmt.Println()
		}
	}
	if failed {
		return 1
	}
	return 0
}
func CheckConfig ( files ... string ) int { failed := false for _ , f := range files { ruleFiles , err := checkConfig ( f ) if err != nil { fmt . Fprintln ( os . Stderr , " " , err ) failed = true } else { fmt . Printf ( " \n " , len ( ruleFiles ) ) } fmt . Println ( ) for _ , rf := range ruleFiles { if n , err := checkRules ( rf ) ; err != nil { fmt . Fprintln ( os . Stderr , " " , err ) failed = true } else { fmt . Printf ( " \n " , n ) } fmt . Println ( ) } } if failed { return 1 } return 0 }
// CheckConfig validates configuration files.
CheckConfig validates configuration files .