Étant donné ces stucts:
type Path struct {
Description string
Paths map[string]Path
}
type Top struct {
Title string
Path
}
Je devrais être capable de démarshaler un YAML comme ceci:
title: Recursive
paths:
a:
paths:
b:
paths:
c:
description: Bottom
Cela fonctionne mais devrait être la même chose que ci-dessus:
type Path struct {
Description string
Paths map[string]Path
}
type Top struct {
Title string
Paths map[string]Path
}
Vous avez besoin du drapeau ,inline
pour cela, selon la documentation :
http://gopkg.in/yaml.v2#Maréchal
Vous pouvez utiliser cet indicateur à la fois sur les champs normaux et sur les champs anonymes.
:+1: Désolé, je sais : RTFM @rnix :gun:
Aucun problème. ;-)
Et merci d'avoir soumis les problèmes. Ils pourraient bien être des problèmes valables.
Commentaire le plus utile
Vous avez besoin du drapeau
,inline
pour cela, selon la documentation :http://gopkg.in/yaml.v2#Maréchal
Vous pouvez utiliser cet indicateur à la fois sur les champs normaux et sur les champs anonymes.