mirror of
https://github.com/grafana/grafana.git
synced 2025-07-29 14:12:41 +08:00
chore(perf): Pre-allocate where possible (enable prealloc linter) (#88952)
* chore(perf): Pre-allocate where possible (enable prealloc linter) Signed-off-by: Dave Henderson <dave.henderson@grafana.com> * fix TestAlertManagers_buildRedactedAMs Signed-off-by: Dave Henderson <dave.henderson@grafana.com> * prealloc a slice that appeared after rebase Signed-off-by: Dave Henderson <dave.henderson@grafana.com> --------- Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
This commit is contained in:
@ -48,11 +48,13 @@ func SplitString(str string) []string {
|
||||
return res
|
||||
}
|
||||
|
||||
var result []string
|
||||
matches := stringListItemMatcher.FindAllString(str, -1)
|
||||
for _, match := range matches {
|
||||
result = append(result, strings.Trim(match, "\""))
|
||||
|
||||
result := make([]string, len(matches))
|
||||
for i, match := range matches {
|
||||
result[i] = strings.Trim(match, "\"")
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user