-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[confmap][fix] Correctly differentiate between nil and empty slices in ToStringMap
#11755
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
Changes from all commits
400205f
aadb6b6
0436e81
c9b7c46
b5fd43b
370bf34
5fb775c
4c21de0
7de2ad3
490c188
3fb5cae
1985c95
2ae04e1
dfdfcbb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Use this changelog template to create an entry for release notes. | ||
|
|
||
| # One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
| change_type: 'bug_fix' | ||
|
|
||
| # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) | ||
| component: confmap | ||
|
|
||
| # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
| note: "Correctly differentiate between a nil and empty slice in `ToStringMap`" | ||
|
|
||
| # One or more tracking issues or pull requests related to the change | ||
| issues: [11749] | ||
|
|
||
| # (Optional) One or more lines of additional information to render under the primary note. | ||
| # These lines will be padded with 2 spaces and then inserted directly into the document. | ||
| # Use pipe (|) for multiline entries. | ||
| subtext: | ||
|
|
||
| # Optional: The change log or logs in which this entry should be included. | ||
| # e.g. '[user]' or '[user, api]' | ||
| # Include 'user' if the change is relevant to end users. | ||
| # Include 'api' if there is a change to a library API. | ||
| # Default: '[user]' | ||
| change_logs: [api] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -133,6 +133,10 @@ | |
| return c | ||
| case []any: | ||
| var newSlice []any | ||
| if m == nil { | ||
| return newSlice | ||
| } | ||
|
Comment on lines
+136
to
+138
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mx-psi This block is currently not covered by tests because we're not decoding nil values in this PR (that will happen in #11734). We could (1) remove this if block here and add it in the following PR; (2) leave it in here but merge with missing code coverage; (3) add a unit test for this function directly. Let me know what you think. |
||
| newSlice = []any{} | ||
| for _, e := range m { | ||
| newSlice = append(newSlice, sanitizeExpanded(e, useOriginal)) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| slice: [] # empty slices are sanitized to nil in ToStringMap | ||
| slice: [] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| slice: |
Uh oh!
There was an error while loading. Please reload this page.