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

[component] make Type implement MarshalText #9856

Merged
merged 4 commits into from
Mar 27, 2024

Conversation

TylerHelmuth
Copy link
Member

Description:
Adds MarshalYAML function so that Type can be properly marshaled as yaml.

We could alternatively fix this issue by updating the components command to explicitly call Type.String and use that value instead of component.Type in its struct.

Link to tracking Issue:
Fixes #9855

Testing:
Tested locally using otelcorecol. The unit test TestNewBuildSubCommand didnt catch the issue because it was also using yaml.Marshal like the command, so the expected value also had {} as the name.

@TylerHelmuth TylerHelmuth requested a review from a team as a code owner March 26, 2024 22:46
Copy link

codecov bot commented Mar 26, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 91.12%. Comparing base (f237238) to head (9f825ac).

❗ Current head 9f825ac differs from pull request most recent head 8b91cda. Consider uploading reports for the commit 8b91cda to get more accurate results

Files Patch % Lines
component/config.go 0.00% 2 Missing ⚠️
config/internal/warning.go 0.00% 1 Missing ⚠️
internal/localhostgate/featuregate.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9856      +/-   ##
==========================================
- Coverage   91.13%   91.12%   -0.01%     
==========================================
  Files         353      353              
  Lines       18746    18748       +2     
==========================================
  Hits        17085    17085              
- Misses       1333     1335       +2     
  Partials      328      328              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

component/config.go Outdated Show resolved Hide resolved
@dmitryax
Copy link
Member

Also, the test for this functionality is pretty useless. It'd be great to update it to compare the expected output with an actual yaml string instead of doing the same marshaling. Could you please update it?

@TylerHelmuth
Copy link
Member Author

I believe the windows test failure is unrelated

@mx-psi mx-psi requested a review from dmitryax March 27, 2024 17:33
@mx-psi mx-psi changed the title [component] make Type implement MarshalYAML [component] make Type implement MarshalText Mar 27, 2024
Copy link
Member

@dmitryax dmitryax left a comment

Choose a reason for hiding this comment

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

Thanks, @TylerHelmuth!

@dmitryax dmitryax merged commit 9c5bf54 into open-telemetry:main Mar 27, 2024
47 checks passed
@github-actions github-actions bot added this to the next release milestone Mar 27, 2024
@TylerHelmuth TylerHelmuth deleted the fix-componets-command branch March 27, 2024 20:33
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.

Components subcommand no longer outputs component names
3 participants