mirror of
				https://github.com/sammy-ette/Hilbish
				synced 2025-08-10 02:52:03 +00:00 
			
		
		
		
	fix: pass other needed params to goroutine to prevent mixups
This commit is contained in:
		
							parent
							
								
									4f959c326a
								
							
						
					
					
						commit
						c05b1b6168
					
				@ -38,7 +38,6 @@ type docPiece struct {
 | 
				
			|||||||
	FuncName string
 | 
						FuncName string
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
var docs = make(map[string]module)
 | 
					var docs = make(map[string]module)
 | 
				
			||||||
var emmyDocs = make(map[string][]emmyPiece)
 | 
					var emmyDocs = make(map[string][]emmyPiece)
 | 
				
			||||||
var prefix = map[string]string{
 | 
					var prefix = map[string]string{
 | 
				
			||||||
@ -156,13 +155,13 @@ func main() {
 | 
				
			|||||||
			modN = "hilbish"
 | 
								modN = "hilbish"
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		go func(modName string) {
 | 
							go func(modName string, modu module) {
 | 
				
			||||||
			defer wg.Done()
 | 
								defer wg.Done()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			f, _ := os.Create("docs/api/" + modN + ".md")
 | 
								f, _ := os.Create("docs/api/" + modName + ".md")
 | 
				
			||||||
			f.WriteString(fmt.Sprintf(header, modN, v.ShortDescription))
 | 
								f.WriteString(fmt.Sprintf(header, modName, modu.ShortDescription))
 | 
				
			||||||
			f.WriteString(fmt.Sprintf("## Introduction\n%s\n\n## Functions\n", v.Description))
 | 
								f.WriteString(fmt.Sprintf("## Introduction\n%s\n\n## Functions\n", modu.Description))
 | 
				
			||||||
			for _, dps := range v.Docs {
 | 
								for _, dps := range modu.Docs {
 | 
				
			||||||
				f.WriteString(fmt.Sprintf("### %s\n", dps.FuncSig))
 | 
									f.WriteString(fmt.Sprintf("### %s\n", dps.FuncSig))
 | 
				
			||||||
				for _, doc := range dps.Doc {
 | 
									for _, doc := range dps.Doc {
 | 
				
			||||||
					if !strings.HasPrefix(doc, "---") {
 | 
										if !strings.HasPrefix(doc, "---") {
 | 
				
			||||||
@ -171,16 +170,16 @@ func main() {
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
				f.WriteString("\n")
 | 
									f.WriteString("\n")
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}(modN)
 | 
							}(modN, v)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		go func(md, modName string) {
 | 
							go func(md, modName string) {
 | 
				
			||||||
			defer wg.Done()
 | 
								defer wg.Done()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			ff, _ := os.Create("emmyLuaDocs/" + modN + ".lua")
 | 
								ff, _ := os.Create("emmyLuaDocs/" + modName + ".lua")
 | 
				
			||||||
			ff.WriteString("--- @meta\n\nlocal " + modN + " = {}\n\n")
 | 
								ff.WriteString("--- @meta\n\nlocal " + modName + " = {}\n\n")
 | 
				
			||||||
			for _, em := range emmyDocs[md] {
 | 
								for _, em := range emmyDocs[md] {
 | 
				
			||||||
				funcdocs := []string{}
 | 
									funcdocs := []string{}
 | 
				
			||||||
				for _, dps := range docs[md].Docs{
 | 
									for _, dps := range docs[md].Docs {
 | 
				
			||||||
					if dps.FuncName == em.FuncName {
 | 
										if dps.FuncName == em.FuncName {
 | 
				
			||||||
						funcdocs = dps.Doc
 | 
											funcdocs = dps.Doc
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
@ -189,9 +188,9 @@ func main() {
 | 
				
			|||||||
				if len(em.Docs) != 0 {
 | 
									if len(em.Docs) != 0 {
 | 
				
			||||||
					ff.WriteString(strings.Join(em.Docs, "\n") + "\n")
 | 
										ff.WriteString(strings.Join(em.Docs, "\n") + "\n")
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				ff.WriteString("function " + modN + "." + em.FuncName + "(" + strings.Join(em.Params, ", ") + ") end\n\n")
 | 
									ff.WriteString("function " + modName + "." + em.FuncName + "(" + strings.Join(em.Params, ", ") + ") end\n\n")
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			ff.WriteString("return " + modN + "\n")
 | 
								ff.WriteString("return " + modName + "\n")
 | 
				
			||||||
		}(mod, modN)
 | 
							}(mod, modN)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	wg.Wait()
 | 
						wg.Wait()
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user