func (w *walkerImpl) walk(ctx context.Context, e *Entry, depth int) ([]Entry, error) {
	entries := []Entry{}
	isStartEntry := e.Path == ""
	if !isStartEntry {
		includeEntry, err := w.visit(ctx, e, depth)
		if err != nil {
			return nil, err
		} else if includeEntry {
			entries = append(entries, *e)
		}
	}
	childDepth := depth + 1
	if int(childDepth) <= w.opts.Maxdepth && e.Supports(plugin.ListAction()) {
		childrenMap, err := plugin.List(ctx, e.pluginEntry.(plugin.Parent))
		if err != nil {
			return nil, fmt.Errorf("could not get children of %v: %w\n", e.Path, err)
		} else {
			children := []Entry{}
			childrenMap.Range(func(cname string, childPluginEntry plugin.Entry) bool {
				child := newEntry(e, childPluginEntry)
				if e.SchemaKnown() {
					childSchema := e.Schema.GetChild(child.TypeID)
					if childSchema == nil {
						return true
					}
					child.Schema = childSchema
				}
				children = append(children, child)
				return true
			})
			sort.Slice(children, func(i, j int) bool {
				return children[i].CName < children[j].CName
			})
			for _, child := range children {
				descendants, err := w.walk(ctx, &child, childDepth)
				if err != nil {
					return nil, err
				}
				entries = append(entries, descendants...)
			}
		}
	}
	return entries, nil
}
walk and visit take pointers because they update e's fields (like its Schema and
Metadata)
package rql
import (
	"context"
	"fmt"
	"sort"
	"github.com/puppetlabs/wash/plugin"
)
type walker interface {
	Walk(ctx context.Context, start plugin.Entry) ([]Entry, error)
}
type walkerImpl struct {
	q    Query
	opts Options
}
var newWalker = func(p Query, opts Options) walker {
	return &walkerImpl{
		q:    p,
		opts: opts,
	}
}
func (w *walkerImpl) Walk(ctx context.Context, start plugin.Entry) ([]Entry, error) {
	startEntry := newEntry(nil, start)
	startEntry.Path = ""
	s, err := plugin.Schema(start)
	if err != nil {
		return nil, err
	}
	if s != nil {
		schema := prune(newEntrySchema(s), w.q, w.opts)
		startEntry.Schema = schema
	}
	entries, err := w.walk(ctx, &startEntry, 0)
	if err != nil {
		return nil, err
	}
	return entries, nil
}