// DumpAny is like FDumpAny but prints to stderr. func DumpAny(root interface{ … } // FDumpAny prints the structure of a rooted data structure // to w by depth-first traversal of the data structure. // // The filter parameter is a regular expression. If it is // non-empty, only struct fields whose names match filter // are printed. // // The depth parameter controls how deep traversal recurses // before it returns (higher value means greater depth). // If an empty field filter is given, a good depth default value // is 4. A negative depth means no depth limit, which may be fine // for small data structures or if there is a non-empty filter. // // In the output, Node structs are identified by their Op name // rather than their type; struct fields with zero values or // non-matching field names are omitted, and "…" means recursion // depth has been reached or struct fields have been omitted. func FDumpAny(w io.Writer, root interface{ … } type dumper … var indentBytes … func (p *dumper) Write(data []byte) (n int, err error) { … } // printf is a convenience wrapper. func (p *dumper) printf(format string, args ...interface{ … } // addr returns the (hexadecimal) address string of the object // represented by x (or "?" if x is not addressable), with the // common prefix between this and the prior address replaced by // "0x…" to make it easier to visually match addresses. func (p *dumper) addr(x reflect.Value) string { … } // dump prints the contents of x. func (p *dumper) dump(x reflect.Value, depth int) { … } func commonPrefixLen(a, b string) (i int) { … }