package main import ( "bytes" "github.com/goccy/go-yaml" "os" ) func read(file string) []byte { data, err := os.ReadFile(file) if err != nil { panic(err) } return data } 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 { return nil, err } return result, nil }