type TreeNode … func (tn *TreeNode) AppendChild(child *TreeNode) { … } func (tn *TreeNode) AncestorNodeChain() Nodes { … } type TreeNodes … func (tn TreeNodes) Nodes() Nodes { … } func (tn TreeNodes) WithID(id uint) *TreeNode { … } func GenerateSpecsFromTreeRoot(tree *TreeNode) Specs { … }