mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 12:32:43 +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:
@ -38,22 +38,25 @@ func (s *Service) externalPluginSources() []plugins.PluginSource {
|
||||
return []plugins.PluginSource{}
|
||||
}
|
||||
|
||||
var srcs []plugins.PluginSource
|
||||
for _, src := range localSrcs {
|
||||
srcs = append(srcs, src)
|
||||
srcs := make([]plugins.PluginSource, len(localSrcs))
|
||||
for i, src := range localSrcs {
|
||||
srcs[i] = src
|
||||
}
|
||||
|
||||
return srcs
|
||||
}
|
||||
|
||||
func (s *Service) pluginSettingSources() []plugins.PluginSource {
|
||||
var sources []plugins.PluginSource
|
||||
sources := make([]plugins.PluginSource, 0, len(s.cfg.PluginSettings))
|
||||
for _, ps := range s.cfg.PluginSettings {
|
||||
path, exists := ps["path"]
|
||||
if !exists || path == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
sources = append(sources, NewLocalSource(plugins.ClassExternal, []string{path}))
|
||||
}
|
||||
|
||||
return sources
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user