// Find a child node, depth first search
Find a child node, depth first search
// Find a child node depth first search
func (n *Node) Find(childUUID string) (node *Node, err error) {
	if n.UUID == childUUID {
		return n, nil
	}
	for _, child := range n.Children {
		if child.UUID == childUUID {
			return child, nil
		}
		found, err := child.Find(childUUID)
		if err != nil {
			continue
		}
		return found, nil
	}
	return nil, fmt.Errorf("child %s not found under %s", childUUID, n.UUID)
}
func ( n * Node ) Find ( childUUID string ) ( node * Node , err error ) { if n . UUID == childUUID { return n , nil } for _ , child := range n . Children { if child . UUID == childUUID { return child , nil } found , err := child . Find ( childUUID ) if err != nil { continue } return found , nil } return nil , fmt . Errorf ( " " , childUUID , n . UUID ) }
Find a child node, depth first search
Find a child node depth first search