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:
Dave Henderson
2024-06-14 14:16:36 -04:00
committed by GitHub
parent e53e6e7caa
commit 6262c56132
43 changed files with 211 additions and 140 deletions

View File

@ -71,7 +71,7 @@ func (m *service) Run(ctx context.Context) error {
return nil
}
var svcs []services.Service
svcs := make([]services.Service, 0, len(m.serviceMap))
for _, s := range m.serviceMap {
svcs = append(svcs, s)
}