diff --git a/.gitignore b/.gitignore index f923c8c..8bdf3fb 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ __debug_bin dist coverage.xml fisherman +.DS_Store diff --git a/internal/handling/rules_helpers.go b/internal/handling/rules_helpers.go index d1aa89c..cf65105 100644 --- a/internal/handling/rules_helpers.go +++ b/internal/handling/rules_helpers.go @@ -26,7 +26,7 @@ func getScriptRules(ruleCollection []Rule) []Rule { } func filterRules(rules []Rule, predicate func(Rule) bool) []Rule { - var filteredRules []Rule + filteredRules := make([]Rule, 0, len(rules)) for _, rule := range rules { if predicate(rule) { diff --git a/internal/utils/string_slice.go b/internal/utils/string_slice.go index e41ee7f..5efb8bb 100644 --- a/internal/utils/string_slice.go +++ b/internal/utils/string_slice.go @@ -5,7 +5,7 @@ import ( ) func Filter(slice []string, predicate func(string) bool) []string { - var resultSlice []string + resultSlice := make([]string, 0, len(slice)) for i := range slice { if predicate(slice[i]) {