547
548// garbage recycle for stmt
549func (s *stmtDecorator) destroy() {
550 go func() {551 s.wg.Wait()
552 _ = s.stmt.Close()
553 }()
593
594// StopTask stop all tasks
595func (m *taskManager) StopTask() {
596 go func() {597 m.stop <- true
598 }()
599}
Function invocations are expected to be synchronous, but this function will execute asynchronously because every instruction of the function is executed in a goroutine. Instead, it is recommended to remove the internal goroutine and call the function using 'go'.
func hello() {
go func() {
fmt.Println("hello world")
}()
}
func world() {
hello()
...
}
func hello() {
fmt.Println("hello world")
}
func world() {
go hello()
...
}