Skip to content

pcommon.Map.MoveTo() clears destination map when source and destination are the same #12887

Closed
@rockdaboot

Description

@rockdaboot

Component(s)

pdata

What happened?

Describe the bug
If m and dst are equal and not empty, m.MoveTo(dst) results in empty maps dst and m.

Code:

func (m Map) MoveTo(dest Map) {

Expectation
MoveTo() should be a no-op if m and dst or the underlying internal maps are equal (as in "using same memory region").

Collector version

main branch

Environment information

No response

OpenTelemetry Collector configuration

Log output

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions