Skip to content
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

[confmap] fix bug of unmarshalling slice values #8017

Merged

Conversation

fatsheep9146
Copy link
Contributor

Description:
fix the bug of unmarshalling slice values for package confmap

Link to tracking Issue:
fix #4001

@fatsheep9146 fatsheep9146 requested a review from a team as a code owner July 4, 2023 05:51
@codecov
Copy link

codecov bot commented Jul 4, 2023

Codecov Report

Patch coverage is 70.00% of modified lines.

Files Changed Coverage
confmap/confmap.go 70.00%

📢 Thoughts on this report? Let us know!.

@fatsheep9146
Copy link
Contributor Author

@dmitryax could you help review this pr?

@dmitryax
Copy link
Member

Please address comments from @bogdandrutu in #6163. I think we should not override with nil but probably should override with []

@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jul 29, 2023
@fatsheep9146
Copy link
Contributor Author

Please address comments from @bogdandrutu in #6163. I think we should not override with nil but probably should override with []

@dmitryax

I think it is already doing like that, in unit test, these two cases are also covered

{
name: "overridden by an empty slice",
cfg: map[string]any{
"strings": []string{},
},
provided: &structWithSlices{
Strings: []string{"xxx", "yyyy"},
},
expected: &structWithSlices{
Strings: []string{},
},
},
{
name: "not overridden by nil",
cfg: map[string]any{
"strings": nil,
},
provided: &structWithSlices{
Strings: []string{"xxx", "yyyy"},
},
expected: &structWithSlices{
Strings: []string{"xxx", "yyyy"},
},
},

  • The default value will not be overrided by nil.
  • The default value will be overrided by [] empty slice.

@github-actions github-actions bot removed the Stale label Jul 30, 2023
confmap/confmap.go Outdated Show resolved Hide resolved
@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Aug 24, 2023
@fatsheep9146
Copy link
Contributor Author

still doing

@dmitryax dmitryax removed the Stale label Aug 24, 2023
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
@fatsheep9146 fatsheep9146 force-pushed the config-unmarshel-slice-bug branch 2 times, most recently from 89df7a6 to 9b48f51 Compare August 30, 2023 03:25
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
@fatsheep9146
Copy link
Contributor Author

@open-telemetry/collector-maintainers
could you help review about this pr?

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for including the detailed documentation @fatsheep9146

@codeboten codeboten merged commit 3d71035 into open-telemetry:main Sep 11, 2023
31 checks passed
@github-actions github-actions bot added this to the next release milestone Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Config unmarshalling doesn't work properly for slice values
3 participants