mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
fix: apply suggested changes
Signed-off-by: François Gouteroux <francois.gouteroux@gmail.com>
This commit is contained in:
parent
8472596fd0
commit
4341b98eb2
|
@ -131,7 +131,7 @@ func main() {
|
||||||
checkRulesCmd := checkCmd.Command("rules", "Check if the rule files are valid or not.")
|
checkRulesCmd := checkCmd.Command("rules", "Check if the rule files are valid or not.")
|
||||||
ruleFiles := checkRulesCmd.Arg(
|
ruleFiles := checkRulesCmd.Arg(
|
||||||
"rule-files",
|
"rule-files",
|
||||||
"The rule files to check, default is read from standard input (STDIN).",
|
"The rule files to check, default is read from standard input.",
|
||||||
).ExistingFiles()
|
).ExistingFiles()
|
||||||
checkRulesLint := checkRulesCmd.Flag(
|
checkRulesLint := checkRulesCmd.Flag(
|
||||||
"lint",
|
"lint",
|
||||||
|
@ -690,7 +690,7 @@ func CheckRules(ls lintConfig, files ...string) int {
|
||||||
failed := false
|
failed := false
|
||||||
hasErrors := false
|
hasErrors := false
|
||||||
|
|
||||||
// add empty string to avoid matching filename
|
// Add empty string to avoid matching filename.
|
||||||
if len(files) == 0 {
|
if len(files) == 0 {
|
||||||
files = append(files, "")
|
files = append(files, "")
|
||||||
}
|
}
|
||||||
|
@ -723,7 +723,7 @@ func checkRules(filename string, lintSettings lintConfig) (int, []error) {
|
||||||
var rgs *rulefmt.RuleGroups
|
var rgs *rulefmt.RuleGroups
|
||||||
var errs []error
|
var errs []error
|
||||||
|
|
||||||
// if filename is an empty string it is a stdin
|
// Empty string is stdin input.
|
||||||
if filename == "" {
|
if filename == "" {
|
||||||
data, err := io.ReadAll(os.Stdin)
|
data, err := io.ReadAll(os.Stdin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue