Skip to content

Fix marshalling of TLSVersion#429

Merged
roidelapluie merged 1 commit intoprometheus:mainfrom
roidelapluie:fix-marshal
Feb 21, 2023
Merged

Fix marshalling of TLSVersion#429
roidelapluie merged 1 commit intoprometheus:mainfrom
roidelapluie:fix-marshal

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
Contributor

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

@LeviHarrison
Copy link
Contributor

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.

2 participants