Merge pull request #12903 from roidelapluie/fix-pr-7023

rulefmt: remove unreachable code
This commit is contained in:
Julien Pivotto 2023-09-29 18:20:40 +02:00 committed by GitHub
commit b6dbfcc15f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -173,17 +173,11 @@ func (r *RuleNode) Validate() (nodes []WrappedError) {
})
}
if r.Record.Value == "" && r.Alert.Value == "" {
if r.Record.Value == "0" {
nodes = append(nodes, WrappedError{
err: fmt.Errorf("one of 'record' or 'alert' must be set"),
node: &r.Alert,
})
} else {
nodes = append(nodes, WrappedError{
err: fmt.Errorf("one of 'record' or 'alert' must be set"),
node: &r.Record,
})
}
nodes = append(nodes, WrappedError{
err: fmt.Errorf("one of 'record' or 'alert' must be set"),
node: &r.Record,
nodeAlt: &r.Alert,
})
}
if r.Expr.Value == "" {