协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
golang-concurrency【开发与工程】Write safe concurrent Go code with goroutines, channels, and context. Use when implementing concurrency with goroutines, channels, or context in Go.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
ctx to manage cancellation, deadlines, and graceful termination.go test -race.errgroup.Group for parallel tasks with error propagation, channels for pipelines, sync.Mutex for simple shared state.sem := make(chan struct{}, maxWorkers)
for _, task := range tasks {
task := task // prevent loop pointer capture
sem <- struct{}{}
g.Go(func() error {
defer func() { <-sem }()
return task.Execute(ctx)
})
}
ctx.Done().go test -race in local dev and CI.See ErrGroup and concurrency patterns and context timeout examples
ctx.Done() or channel closure.&item) into a concurrent closure.errgroup or sync.WaitGroup for lifecycle tracking.