如何安全地退出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
相关文章
相关标签/搜索