Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix: Call UnmarshalYAML on literal empty string values #57
If you have the YAML
I've added an example at the end of decode_test.go, but a practical example exists in the Kubernetes project struct util.IntOrString. With IntOrString, a YAML value turns into an IntOrString object which is created and filled in differently whether the value is an int or string in the YAML. So,
YAML v1 has the correct behavior since
referenced this pull request
Nov 25, 2014
I don't understand why "" would result in calling an unmarshaler while an implicit "" would not. This is very inconsistent. I'm happy to fix the bug, but not like that.
Given the discussion in that ticket referenced above, I'm assuming are not interested in contributing to the project anymore, and will close this and fix the bug.
Because an empty string is not the same as null in Go. How do you propose fixing it instead?
As I commented, we are still using go-yaml/yaml for parsing YAML, but not for marshaling/unmarshaling. If the behavior were made to be more strongly consistent with how Golang marshals and unmarshals, we would consider switching back.
Yes, you're right. I forgot "a:" actually implies a is null in YAML.
I'm happy to accept this in. For that, can you please:
a) Sign the contributor agreement at:
b) Preserve the original formatting of the line (no unnecessary parenthesis, as usual in Go) while adding the intended change?
Thanks for these.