Example
package main import ( "log" "sync" "time" ) func main() { var wg sync.WaitGroup wg.Add(1) go waitTime(&wg) wg.Wait() } func waitTime(wg *sync.WaitGroup) { time.Sleep(time.Second * 2) log.Println("wait finished!") wg.Done() }
新的博客地址请访问:https://blog.imekaku.com/
package main import ( "log" "sync" "time" ) func main() { var wg sync.WaitGroup wg.Add(1) go waitTime(&wg) wg.Wait() } func waitTime(wg *sync.WaitGroup) { time.Sleep(time.Second * 2) log.Println("wait finished!") wg.Done() }
开始在上面输入您的搜索词,然后按回车进行搜索。按ESC取消。