@@ -53,14 +53,14 @@ func CheckRules(data []byte) error {
5353 rgs , errs := rulefmt .Parse (data , ls .ignoreUnknownFields )
5454 var ruleErrors , checkGroupErrors error
5555 if errs != nil {
56- errStr := make ([]string , len (errs ))
56+ errStr := make ([]string , 0 , len (errs ))
5757 for _ , e := range errs {
5858 errStr = append (errStr , e .Error ())
5959 }
6060 ruleErrors = fmt .Errorf ("%s" , strings .Join (errStr , "\n " ))
6161 }
6262 if errs := checkRuleGroups (rgs , ls ); errs != nil {
63- errStr := make ([]string , len (errs ))
63+ errStr := make ([]string , 0 , len (errs ))
6464 for _ , e := range errs {
6565 errStr = append (errStr , e .Error ())
6666 }
@@ -118,7 +118,7 @@ func compare(a, b compareRuleType) int {
118118
119119func checkDuplicates (groups []rulefmt.RuleGroup ) []compareRuleType {
120120 var duplicates []compareRuleType
121- var cRules compareRuleTypes
121+ cRules := make ( compareRuleTypes , 0 , 100 ) // Preallocate with reasonable capacity
122122
123123 for _ , group := range groups {
124124 for _ , rule := range group .Rules {
0 commit comments