File tree Expand file tree Collapse file tree 1 file changed +12
-15
lines changed Expand file tree Collapse file tree 1 file changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,6 @@ import (
1414 "sync"
1515 "sync/atomic"
1616 "unicode"
17-
18- "github.com/cockroachdb/pebble/internal/treeprinter"
1917)
2018
2119const Enabled = true
@@ -281,20 +279,19 @@ func firstWord(str string) string {
281279// TreeToString returns a string representation of the current state of a Node
282280// tree.
283281func TreeToString (n Node ) string {
284- tp := treeprinter .New ()
285- treePrint (n , tp )
286- return tp .String ()
287- }
288-
289- func treePrint (n Node , tp treeprinter.Node ) {
290- ni := n .TreeStepsNode ()
291- tpNode := tp .Child (ni .name )
292- for _ , prop := range ni .properties {
293- tpNode .Childf ("%s: %s" , prop [0 ], prop [1 ])
294- }
295- for _ , child := range ni .children {
296- treePrint (child , tpNode )
282+ var buildTree func (n Node ) TreeNode
283+ buildTree = func (n Node ) TreeNode {
284+ var t TreeNode
285+ info := n .TreeStepsNode ()
286+ t .Name = info .name
287+ t .Properties = info .properties
288+ for _ , child := range info .children {
289+ t .Children = append (t .Children , buildTree (child ))
290+ }
291+ return t
297292 }
293+ t := buildTree (n )
294+ return t .String ()
298295}
299296
300297type nodeState struct {
You can’t perform that action at this time.
0 commit comments