-
Notifications
You must be signed in to change notification settings - Fork 137
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
Bug fix: decode TOML array of tables #652
Conversation
@@ -74,7 +74,13 @@ func (c Conversion) fromUnorderedMaps(object interface{}) interface{} { | |||
typedObj[i] = c.fromUnorderedMaps(item) | |||
} | |||
return typedObj | |||
|
|||
case []map[string]interface{}: |
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.
Having the case map[interface{}]interface{}:
earlier in this function makes me think that we should cover the similar case: []map[interface{}]interface{}:
. However, I could not construct a TOML map with non 'string' map keys.
Ultimately, I was left with this question:
- "Why is the input of an array of maps not covered by the
[]interface{}
case?"
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.
Another way to ask the question:
- "Why does
toml.decode
return different types of slices rather than always returning[]interface{}
"
Found others hitting up against the toml.Unmarshal
inconsistencies: BurntSushi/toml#169
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.
LGTM.
In addition to @cppforlife's formatting nits, I'm suggesting a note to explain both where this specific type of slice is coming from and why we can't just combine all the cases... for now.
Thanks for tackling this one, @gcheadle-vmware.
fixes: #630
added
case []map[string]interface{}:
to conversion process.