-
Notifications
You must be signed in to change notification settings - Fork 11
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
Use json.RawMessage type to avoid unnecessary json.Unmarshal #255
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @rtorrero ,
What if the output of the command for some error is not json?
The Unmarshal
would catch that
It shouldn't matter, since we aren't doing anything with the JSON itself (It should fail once we try to unmarshal or decode it). If I understood it correctly, for us |
Well, you check at least that it is a json format. |
This would be caught by
in our collector. We could catch it here if you prefer, but IMO that defeats a bit the purpose of this PR |
2b2e1d7
to
74e4128
Compare
This PR changes the SaptuneDiscoveryPayload struct to avoid the usage of
interface{}
type andjson.Unmarshal
. Instead we use ajson.RawMessage
that prevents the payload from being quoted.