func attachDebugger(s *AppSetup) { debugger.RunShell(dbg) f := s.Extender s.Extender = func(q *Query) Querys { result := f(q) dbg.Break(func() { fmt.Fprintf(dbg.Logout, "extending: %v\n", q.String()) for _, extended := range result { fmt.Fprintf(dbg.Logout, " | %v\n", q.String()) if *verbose { fmt.Fprintf(dbg.Logout, "\tE:%v\tO:%v\n", s.Extendable(extended), s.Outputtable(extended)) } } }) return result } }
func main() { d := debugger.New() debugger.RunShell(d) adder := AttachDebugger(d, Adder) done := make(chan int, 100) for i := 0; i < 10; i += 1 { go func(a int) { fmt.Printf(".") adder(a, a*3) fmt.Printf("-") done <- 1 }(i) } for i := 0; i < 10; i += 1 { <-done } print("\n\n") }