import ( "fmt" "sync" "time")var a int64 = 0var b int64 = 0func main() { wg:=sync.WaitGroup{} wg.Add(1) go func() { defer wg.Done() a=1 b=2 }() wg.Wait() go func() { fmt.Println(a,b) }() time.Sleep(time.Millisecond)}//1 2