1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-10-31 07:33:00 +00:00

Improve validation helpers

Still, there are a lot of bugs in the shroom module to be fixed later.
This commit is contained in:
Umar Getagazov
2021-10-27 13:43:01 +07:00
parent 6eab333ba8
commit 649a6b91cb
9 changed files with 60 additions and 50 deletions

View File

@@ -127,7 +127,7 @@ type child struct {
func figureOutChildren(hyphaName string, exists bool) child {
var (
descPrefix = hyphaName + "/"
child = child{hyphaName, true, make([]child, 0)}
child = child{hyphaName, true, make([]child, 0)}
)
for desc := range hyphae.YieldExistingHyphae() {
@@ -153,9 +153,9 @@ func addHyphaToChild(hyphaName, subPath string, child *child) {
} else {
var (
firstSlash = strings.IndexRune(subPath, '/')
firstDir = subPath[:firstSlash]
restOfPath = subPath[firstSlash + 1:]
subchild = findOrCreateSubchild(firstDir, child)
firstDir = subPath[:firstSlash]
restOfPath = subPath[firstSlash+1:]
subchild = findOrCreateSubchild(firstDir, child)
)
addHyphaToChild(hyphaName, restOfPath, subchild)
}
@@ -172,7 +172,7 @@ func findOrCreateSubchild(name string, baseChild *child) *child {
}
}
baseChild.children = append(baseChild.children, child{fullName, false, make([]child, 0)})
return &baseChild.children[len(baseChild.children) - 1]
return &baseChild.children[len(baseChild.children)-1]
}
type sibling struct {