When using https://pastes.dev/11FXTHnM2m yaml file lines are getting alphabetically sorted and any comments or blank line gets removed
Before
After
I think this is because we handle Yaml by converting it to Json then converting back to Yaml.
|
// Unmarshal the yaml data into a JSON interface such that we can work with |
|
// any arbitrary data structure. If we don't do this, I can't use gabs which |
|
// makes working with unknown JSON significantly easier. |
|
jsonBytes, err := json.Marshal(dyno.ConvertMapI2MapS(i)) |
|
if err != nil { |
|
return err |
|
} |
|
|
|
// Now that the data is converted, treat it just like JSON and pass it to the |
|
// iterator function to update values as necessary. |
|
data, err := f.IterateOverJson(jsonBytes) |
|
if err != nil { |
|
return err |
|
} |
|
|
|
// Remarshal the JSON into YAML format before saving it back to the disk. |
|
marshaled, err := yaml.Marshal(data.Data()) |
|
if err != nil { |
|
return err |
|
} |
When using https://pastes.dev/11FXTHnM2m yaml file lines are getting alphabetically sorted and any comments or blank line gets removed
Before
After
I think this is because we handle Yaml by converting it to Json then converting back to Yaml.
wings/parser/parser.go
Lines 433 to 452 in 9f1dbd4