open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.1k stars 2.39k forks source link

[chore] Remove unnecessary internal common maps package. #36390

Open bogdandrutu opened 6 days ago

atoulme commented 6 days ago
=== FAIL: . TestReceiverWithMetadata (0.20s)
panic: assignment to entry in nil map [recovered]
    panic: assignment to entry in nil map
make[2]: *** [../../Makefile.Common:136: test-with-cover] Error 3

goroutine 482 [running]:
testing.tRunner.func1.2({0x3080120, 0x380f4e0})
    /opt/hostedtoolcache/go/1.22.8/x64/src/testing/testing.go:1631 +0x3f7
testing.tRunner.func1()
    /opt/hostedtoolcache/go/1.22.8/x64/src/testing/testing.go:1634 +0x6b6
panic({0x3080120?, 0x380f4e0?})
    /opt/hostedtoolcache/go/1.22.8/x64/src/runtime/panic.go:770 +0x132
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/pod.GetMetadata(0xc000a4a908, 0xc000d84220, 0xc000d81100)
    /home/runner/work/opentelemetry-collector-contrib/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/pod/pods.go:128 +0x150

Looks like there is at least one problem CI picked up.

EDIT: looks like maps.Clone, if passed a nil map, will return a nil map: https://go.dev/play/p/t6VA4ZMC6b7