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

Fix marshalling of TLSVersion #429

Merged
merged 1 commit into from Feb 21, 2023

Conversation

roidelapluie
Copy link
Member

Signed-off-by: Julien Pivotto roidelapluie@o11y.eu

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
@roidelapluie
Copy link
Member Author

This change updates the MarshalYAML and MarshalJSON functions for the TLSVersion type to remove the pointer notation *tv. This means that the functions will now take a value of type TLSVersion instead of a pointer to a TLSVersion as an argument.

The reason for this change is because the functions previously did not implement the json.Marshaler or yaml.Marshaler interfaces, which expect a value to be passed as the argument rather than a pointer. By removing the pointer notation, the functions should now work correctly when passed a value of type TLSVersion.

It's worth noting that the UnmarshalYAML and UnmarshalJSON functions for TLSVersion are not changed, and continue to accept a pointer as the argument. This is because these functions implement the yaml.Unmarshaler and json.Unmarshaler interfaces, respectively, which expect a pointer to be passed as the argument.

Note: generated with the help of chatgpt

@LeviHarrison
Copy link
Member

Looks good, but do you mind adding a test to be safe?

@LeviHarrison
Copy link
Member

Note: generated with the help of chatgpt

🤣

@roidelapluie roidelapluie merged commit ff69f32 into prometheus:main Feb 21, 2023
@roidelapluie
Copy link
Member Author

I will add tests later.

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.

None yet

2 participants