Hi all, I have a question, interesting:
Why the executes is diferente in these both situations? Execute A: [11:19] ```package main import ( "fmt" "sync" "time" ) var wg sync.WaitGroup func A() { time.Sleep(time.Second * 5) fmt.Println("Função A") wg.Done() } func B() { fmt.Println("Função B") wg.Done() } func C() { time.Sleep(time.Second * 5) fmt.Println("Função C") wg.Done() } func main() { wg.Add(3) defer wg.Wait() go A() go B() go C() } ``` Execute B: [11:20] ```package main import ( "fmt" "sync" "time" ) var wg sync.WaitGroup func A() { fmt.Println("Função A") time.Sleep(time.Second * 5) wg.Done() } func B() { fmt.Println("Função B") wg.Done() } func C() { fmt.Println("Função C") time.Sleep(time.Second * 5) wg.Done() } func main() { wg.Add(3) defer wg.Wait() go A() go B() go C() } ``` [11:21] In execute A, function A and C wait 5 seconds, then prints output. In execute B no, all the prints executes without respecting time.Sleep. Someone can explain why? [11:22] I only change the order of time.Sleep in functions A and C. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.