trie.go
func (p *prefixTrie) walkDepth() <-chan RangerEntry {
	entries := make(chan RangerEntry)
	go func() {
		if p.hasEntry() {
			entries <- p.entry
		}
		childEntriesList := []<-chan RangerEntry{}
		for _, trie := range p.children {
			if trie == nil {
				continue
			}
			childEntriesList = append(childEntriesList, trie.walkDepth())
		}
		for _, childEntries := range childEntriesList {
			for entry := range childEntries {
				entries <- entry
			}
		}
		close(entries)
	}()
	return entries
}
func (p *prefixTrie) walkDepth() <-chan RangerEntry {
	entries := make(chan RangerEntry)
	go func() {
		if p.hasEntry() {
			entries <- p.entry
		}
		childEntriesList := []<-chan RangerEntry{}
		for _, trie := range p.children {
			if trie == nil {
				continue
			}
			childEntriesList = append(childEntriesList, trie.walkDepth())
		}
		for _, childEntries := range childEntriesList {
			for entry := range childEntries {
				entries <- entry
			}
		}
		close(entries)
	}()
	return entries
}
func ( p * prefixTrie ) walkDepth ( ) <- chan RangerEntry { entries := make ( chan RangerEntry ) go func ( ) { if p . hasEntry ( ) { entries <- p . entry } childEntriesList := [ ] <- chan RangerEntry { } for _ , trie := range p . children { if trie == nil { continue } childEntriesList = append ( childEntriesList , trie . walkDepth ( ) ) } for _ , childEntries := range childEntriesList { for entry := range childEntries { entries <- entry } } close ( entries ) } ( ) return entries }
// walkDepth walks the trie in depth order, for unit testing.
walkDepth walks the trie in depth order for unit testing .