VIM-GO: auto-reformatting by vim-go

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2021-10-06 11:56:52 -05:00
parent 62010a8d16
commit 375444ea28
1 changed files with 30 additions and 12 deletions

View File

@ -1,11 +1,16 @@
package gui package gui
import "log" import (
"log"
import "github.com/andlabs/ui" "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest" _ "github.com/andlabs/ui/winmanifest"
)
// https://ieftimov.com/post/golang-datastructures-trees/
type Node struct { type Node struct {
id int
Name string Name string
tag string tag string
Width int Width int
@ -27,3 +32,16 @@ func (n Node) Append(child Node) {
// } // }
// n.uiType.Append(child, x) // n.uiType.Append(child, x)
} }
func findByIdDFS(node *Node, id string) *Node {
if node.id == id {
return node
}
if len(node.children) > 0 {
for _, child := range node.children {
findByIdDFS(child, id)
}
}
return nil
}