mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Amends `ToStringMap` so that it returns `map[string]any(nil)` if the map
used to create this `Conf` was nil. Currently it returns an empty map.
I consider this a bug since, while not explicitly undocumented, I would
expect the following two properties to be true, and they were not before
this change:
1. For any map `m` without `expandedValue`s,
`NewFromStringMap(m).ToStringMap() == m`
2. For any map `m` without `expandedValue`s and any `path` referencing
an existing key in `m` with a `map[string]any` value,
`NewFromStringMap(m).Sub(path) == m[path[0]][path[1]][...][path[N]]`
<!-- Issue number if applicable -->
#### Link to tracking issue
I need this to be able to distinguish between
```
foo:
bar:
```
and
```
foo:
bar: {}
```
which currently have different behaviors when mapping to pointers.
The goal is to be able to do #13168
3 lines
19 B
YAML
3 lines
19 B
YAML
field:
|
|
key: null
|