Hi I hava a following Golang program which contain a Go Routine.
func main() {
go func(){
fmt.Println("Break Point 1")
}()
fmt.Println("Break Point 2")
time.Sleep(100 * time.Second)
fmt.Println("hello")
}
Now my program doesn't break at breakpoint 1. How do I debug routines also?
func main() {
go func() {
fmt.Println("Break Point 1")
}()
fmt.Println("Break Point 2")
time.Sleep(1 * time.Second)
fmt.Println("hello")
}
It seems like before the go routine gets scheduled the program terminates and that is the reason the breakpoint is not reached. Can you try adding sleep in main routine?