Description
Describe the bug
If we have a default config for a component where there is a slice value with 2 and more item, there is no way to override that value with a smaller slice.
The problem is that mapstructure.decodeMap func that we use for unmarshalling compares elements of the slice one by one and does not override the length of the result. It leads to the problem that we cannot override a default slice value with a slice of smaller size.
This is an unexpected behaviour for users. We should be able to fully override default slice values.
Steps to reproduce
Real example is https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/dotnetdiagnosticsreceiver configuration:
Try to override the counters
value with a 1-item slice like this:
receivers:
dotnet_diagnostics:
counters: ["MyCounters"]
What did you expect to see?
A slice config value should be fully overridden. In the example above, we should get counters: ["MyCounters"]
What did you see instead?
Only subset of the default slice items are overridden, the rest of the default slice stays the same. In the example above, we get counters: ["MyCounters", "Microsoft.AspNetCore.Hosting"]