Skip to content

Commit 314df7b

Browse files
authored
[chore] do not initialize empty slices (#3626)
1 parent 700d732 commit 314df7b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/otel-allocator/allocation/allocator.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ func (a *allocator) handleTargets(diff diff.Changes[*target.Item]) {
178178
}
179179

180180
// Check for additions
181-
assignmentErrors := []error{}
181+
var assignmentErrors []error
182182
for k, item := range diff.Additions() {
183183
// Do nothing if the item is already there
184184
if _, ok := a.targetItems[k]; ok {
@@ -297,7 +297,7 @@ func (a *allocator) handleCollectors(diff diff.Changes[*Collector]) {
297297
a.strategy.SetCollectors(a.collectors)
298298

299299
// Re-Allocate all targets
300-
assignmentErrors := []error{}
300+
var assignmentErrors []error
301301
for _, item := range a.targetItems {
302302
err := a.addTargetToTargetItems(item)
303303
if err != nil {

0 commit comments

Comments
 (0)