mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 14:12:26 +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:
@ -62,9 +62,10 @@ func DirAsLocalSources(pluginsPath string, class plugins.Class) ([]*LocalSource,
|
||||
}
|
||||
slices.Sort(pluginDirs)
|
||||
|
||||
var sources []*LocalSource
|
||||
for _, dir := range pluginDirs {
|
||||
sources = append(sources, NewLocalSource(class, []string{dir}))
|
||||
sources := make([]*LocalSource, len(pluginDirs))
|
||||
for i, dir := range pluginDirs {
|
||||
sources[i] = NewLocalSource(class, []string{dir})
|
||||
}
|
||||
|
||||
return sources, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user