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:
@@ -97,9 +97,8 @@ func (e externalAlertmanagerToDatasources) Exec(sess *xorm.Session, mg *migrator
|
||||
}
|
||||
|
||||
func removeDuplicates(strs []string) []string {
|
||||
var res []string
|
||||
found := map[string]bool{}
|
||||
|
||||
found := make(map[string]bool, len(strs))
|
||||
res := make([]string, 0, len(strs))
|
||||
for _, str := range strs {
|
||||
if found[str] {
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user