-
Notifications
You must be signed in to change notification settings - Fork 57
Unmarshal instance metadata JSON #40
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
base: master
Are you sure you want to change the base?
Conversation
@tianxiaoliang Thanks for the contribution! I'm trying to find some time to test it out so I can get it merged. |
marshal.go
Outdated
// the raw JSON for later parsing. | ||
func (i *InstanceMetadata) UnmarshalJSON(b []byte) error { | ||
i.Raw = b | ||
// TODO(cq) could actually parse Raw here, and in a parallel UnmarshalXML as well. |
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.
Update the comment to note the only outstanding proposal: unmarshal the XML. You took care of the first proposal here.
Done |
func (ins *Instance) SetMetadataString(key, value string) { | ||
if ins.Metadata.parsed == nil { | ||
ins.Metadata.parsed = map[string]interface{}{} | ||
if ins.Metadata.Parsed == nil { |
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.
Given that we can set entries in this field, "Parsed" doesn't match its use. "Parsed" implies that we only receive these values.
Again, consider renaming it to "Map", "Fields", "Values", or something similar.
@tianxiaoliang Would you like to address @seh comments here. I want this to be merged ;) Please also make sure that tests are working after the change for JSON. |
No description provided.