Browse Source

fix bug missing an error. (#7020)

Signed-off-by: johncming <johncming@yahoo.com>
pull/7024/head
johncming 5 years ago committed by GitHub
parent
commit
51c824543b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      pkg/rulefmt/rulefmt.go

16
pkg/rulefmt/rulefmt.go

@ -264,12 +264,22 @@ func Parse(content []byte) (*RuleGroups, []error) {
var (
groups RuleGroups
node ruleGroups
errs []error
)
err := yaml.Unmarshal(content, &groups)
_err := yaml.Unmarshal(content, &node)
if err != nil || _err != nil {
return nil, []error{err}
if err != nil {
errs = append(errs, err)
}
err = yaml.Unmarshal(content, &node)
if err != nil {
errs = append(errs, err)
}
if len(errs) > 0 {
return nil, errs
}
return &groups, groups.Validate(node)
}

Loading…
Cancel
Save