Angesichts dieser Stukte:
type Path struct {
Description string
Paths map[string]Path
}
type Top struct {
Title string
Path
}
Ich sollte in der Lage sein, eine YAML wie folgt zu entpacken:
title: Recursive
paths:
a:
paths:
b:
paths:
c:
description: Bottom
Das funktioniert, sollte aber dasselbe sein wie oben:
type Path struct {
Description string
Paths map[string]Path
}
type Top struct {
Title string
Paths map[string]Path
}
Sie benötigen dafür das Flag ,inline
gemäß der Dokumentation:
http://gopkg.in/yaml.v2#Marschall
Sie können dieses Flag sowohl für normale als auch für anonyme Felder verwenden.
:+1: Entschuldigung, ich weiß: RTFM @rnix :gun:
Kein Problem. ;-)
Und vielen Dank für das Einreichen der Probleme. Sie könnten durchaus gültige Probleme sein.
Hilfreichster Kommentar
Sie benötigen dafür das Flag
,inline
gemäß der Dokumentation:http://gopkg.in/yaml.v2#Marschall
Sie können dieses Flag sowohl für normale als auch für anonyme Felder verwenden.