-
Notifications
You must be signed in to change notification settings - Fork 129
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(file) convert yaml to JSON #229
Conversation
421ea6c
to
a3e2b5e
Compare
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 but see comments, feel free to merge after resolution
file/readfile.go
Outdated
// yamlUnmarshal is a wrapper around yaml.Unmarshal to ensure that the right | ||
// yaml package is in use. The verification for this is done using a test. | ||
func yamlUnmarshal(bytes []byte, v interface{}) error { | ||
return yaml.Unmarshal(bytes, v) |
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.
optional suggestion: import by a nonstardard name, e.g. ghodssyaml
, to make it harder for goimports to tamper with this import
file/readfile.go
Outdated
if err != nil { | ||
return nil, err | ||
} | ||
return &content, nil | ||
} | ||
|
||
// yamlUnmarshal is a wrapper around yaml.Unmarshal to ensure that the right | ||
// yaml package is in use. The verification for this is done using a test. |
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.
please explain (to the future reader) what behavior is desired (and what is undesired) from this function.
`go-yaml` marshals into `map[interface{}]interface{}`. This change ensures that `map[interface{}]interface{}` is converted into `map[string]interface{}` RECURSIVELY. See #144
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.
go-yaml
marshals intomap[interface{}]interface{}
.This change ensures that
map[interface{}]interface{}
is converted intomap[string]interface{}
RECURSIVELY.This patch needs tests before it can be merged.Added a test.See #144