-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[configoptional] Make Unmarshal into None[T] match unmarshal into (*T)(nil) #13168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mx-psi
merged 5 commits into
open-telemetry:main
from
mx-psi:mx-psi/configoptional-to-none-unmarshal
Jun 10, 2025
Merged
[configoptional] Make Unmarshal into None[T] match unmarshal into (*T)(nil) #13168
mx-psi
merged 5 commits into
open-telemetry:main
from
mx-psi:mx-psi/configoptional-to-none-unmarshal
Jun 10, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5cd0415
to
53bdd95
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #13168 +/- ##
=======================================
Coverage 91.27% 91.27%
=======================================
Files 510 510
Lines 28753 28758 +5
=======================================
+ Hits 26245 26250 +5
Misses 1993 1993
Partials 515 515 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
53bdd95
to
e493250
Compare
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jun 9, 2025
<!--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
…one[T] to match unmarshaling into (*T)(nil)
e493250
to
9da4ec3
Compare
I will add a changelog if this does not get merged before today's release |
evan-bradley
approved these changes
Jun 9, 2025
Co-authored-by: Evan Bradley <[email protected]>
jmacd
approved these changes
Jun 9, 2025
Merged
via the queue into
open-telemetry:main
with commit Jun 10, 2025
1245105
64 of 73 checks passed
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jun 12, 2025
) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Use flavor instead of `hasValue` and `notNone` <!-- Issue number if applicable --> #### Link to tracking issue Updates #13181 using #13168 (comment)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Makes it so that unmarshaling into a
None[T]
is equivalent to unmarshaling into a(*T)(nil)
.The goal is to be able to do #13109 without introducing any changes to the behavior.
Needs #13161.
Testing
Add a unit test to compare the behavior of unmarshaling into
(*T)(nil)
with that of unmarshaling intoNone[T]
Documentation
Amend docstrings