Closed sercxanto closed 10 months ago
@sercxanto It seems that it is not that the above structure cannot be unmarshalled, but that the variable that your program is specifying to unmarshal is **main.firstLevelStruct
( not *main.firstLevelStruct
).
This is not the way it is supposed to be specified.
@goccy Ah I see, my mistake. I am closing this issue.
go-yaml is unable to unmarshall the following yaml:
given the following structs:
It can marshall the struct to a byte slice, but can't unmarshal the same byte slice back again, but fails instead with an error "cannot unmarshal map[string]interface {} into Go value of type *main.firstLevelStruct"
The struct / yaml combination above works with the library "gopkg.in/yaml.v3", so I guess it is an issue in go-yaml.
Please see this go playground URL on how it can be reproduced: https://go.dev/play/p/5RSLg2-vQFQ