如何安全地退出goroutine

摘自"go語言高級編程"web 1.利用chan 2.利用context package main import ( "context" "fmt" "sync" "time" ) func worker(ctx context.Context, wg *sync.WaitGroup) error { defer wg.Done() for { select { defau
相關文章
相關標籤/搜索