Skip to content

Commit a8d3c95

Browse files
committed
Return ref to rule in slice to avoid allocation
1 parent 291d009 commit a8d3c95

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

codeowners.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ type Ruleset []Rule
104104
// last matching rule takes precedence.
105105
func (r Ruleset) Match(path string) (*Rule, error) {
106106
for i := len(r) - 1; i >= 0; i-- {
107-
rule := r[i]
107+
rule := &r[i]
108108
match, err := rule.Match(path)
109109
if match || err != nil {
110-
return &rule, err
110+
return rule, err
111111
}
112112
}
113113
return nil, nil

0 commit comments

Comments
 (0)