preserving ordering in arrays.

This commit is contained in:
2025-01-10 19:38:43 +01:00
parent b06f6af708
commit c21adb9a35
3 changed files with 18 additions and 7 deletions
+3 -3
View File
@@ -14,13 +14,13 @@ func read(file string) []byte {
return data
}
func parse(data []byte) yaml.MapSlice {
func parse(data []byte) (yaml.MapSlice, error) {
var result yaml.MapSlice
decoder := yaml.NewDecoder(bytes.NewReader(data),
yaml.UseOrderedMap())
err := decoder.Decode(&result)
if err != nil {
panic(err)
return nil, err
}
return result
return result, nil
}