From 4b3b63a03f9ddf7333040c5d1c7096dcd756f9c8 Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Sun, 19 Jan 2025 16:06:50 -0800 Subject: [PATCH] [chore] do not initialize empty slices --- cmd/otel-allocator/allocation/allocator.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/otel-allocator/allocation/allocator.go b/cmd/otel-allocator/allocation/allocator.go index b0a9125ba9..57319e6fac 100644 --- a/cmd/otel-allocator/allocation/allocator.go +++ b/cmd/otel-allocator/allocation/allocator.go @@ -178,7 +178,7 @@ func (a *allocator) handleTargets(diff diff.Changes[*target.Item]) { } // Check for additions - assignmentErrors := []error{} + var assignmentErrors []error for k, item := range diff.Additions() { // Do nothing if the item is already there if _, ok := a.targetItems[k]; ok { @@ -297,7 +297,7 @@ func (a *allocator) handleCollectors(diff diff.Changes[*Collector]) { a.strategy.SetCollectors(a.collectors) // Re-Allocate all targets - assignmentErrors := []error{} + var assignmentErrors []error for _, item := range a.targetItems { err := a.addTargetToTargetItems(item) if err != nil {