mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-23 17:20:24 +08:00
8403ed16ae
* ci: add Lint check on commits * ci: fix Lint script error * test: fix go vet errors * test: fix go vet errors, remove gofumpt to check go vet * test: fix go vet errors, try gofumpt * test: fix go vet errors, try gofumpt, round 1 * test: fix go vet errors, try gofumpt, round 2 * ci: fix Lint errors
34 lines
578 B
Go
34 lines
578 B
Go
//go:build debug
|
|
// +build debug
|
|
|
|
package search
|
|
|
|
import "fmt"
|
|
|
|
func (t *Tree) Print() {
|
|
if t.root.item == nil {
|
|
fmt.Println("/")
|
|
} else {
|
|
fmt.Printf("/:%#v\n", t.root.item)
|
|
}
|
|
printNode(t.root, 1)
|
|
}
|
|
|
|
func printNode(n *node, depth int) {
|
|
indent := make([]byte, depth)
|
|
for i := 0; i < len(indent); i++ {
|
|
indent[i] = '\t'
|
|
}
|
|
|
|
for _, children := range n.children {
|
|
for k, v := range children {
|
|
if v.item == nil {
|
|
fmt.Printf("%s%s\n", string(indent), k)
|
|
} else {
|
|
fmt.Printf("%s%s:%#v\n", string(indent), k, v.item)
|
|
}
|
|
printNode(v, depth+1)
|
|
}
|
|
}
|
|
}
|