format another way

This commit is contained in:
Aleksandr Trushkin
2024-02-07 17:45:00 +03:00
parent b8ce09f7ec
commit 504e5fce29
2 changed files with 38 additions and 12 deletions

View File

@ -158,7 +158,14 @@ func (r *radixMatcher) Register(pattern string) {
}
func (r *radixMatcher) Patterns() []string {
out := make([]string, len(r.saved))
copy(out, r.saved)
ownIdx := len(r.saved)
out := make([]string, len(r.saved)+len(r.regexps))
copy(out, r.saved[:ownIdx])
for i := 0; i < len(r.regexps); i++ {
idx := i + ownIdx
out[idx] = r.regexps[i].String()
}
return out
}