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:
		
							
								
								
									
										10
									
								
								tree/tree.go
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								tree/tree.go
									
									
									
									
									
								
							| @@ -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 { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Umar Getagazov
					Umar Getagazov