鉴于这些结构:
type Path struct {
Description string
Paths map[string]Path
}
type Top struct {
Title string
Path
}
我应该能够像这样解组 YAML:
title: Recursive
paths:
a:
paths:
b:
paths:
c:
description: Bottom
这可行,但应该与上述相同:
type Path struct {
Description string
Paths map[string]Path
}
type Top struct {
Title string
Paths map[string]Path
}
:+1: 抱歉,我知道:RTFM @rnix :gun:
没问题。 ;-)
并感谢您提交问题。 它们很可能是有效的问题。
最有用的评论
根据文档,您需要
,inline
标志:http://gopkg.in/yaml.v2#Marshal
您可以在普通字段和匿名字段上使用该标志。