You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In current yamlMarshal and Unmarshal processes do not preserve the order when a specific struct is not used. However, there's an alternative approach to preserve the order which is using the yaml.MapSlice when doing Marshal & Unmarshal. However, this has an additional work around when comes to the data modification part in the interface. Wouldn't it be good to have a separate function parameter which works on preserving the oder when encoding & decoding?
yaml.Marshal(interface, True) - Second parameter will be considered for the order preservation (if it's true then order will be preserved, otherwise, order preservation is not guaranteed. Default value can be set toTrue since a user wants to have the same order when reading & writing.
yaml.Unmarshal(content, interface, True) - Same as the above method