go-concurrency-pipelines
Design, implement, test, and review bounded in-process Go concurrency using goroutines, channels, iterators, mutexes, shared collections, WaitGroup,…
它会碰到什么
这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。
技能内容
Go Concurrency Pipelines
Every goroutine needs an owner, a stop condition, and a completion path. Bound
admission before optimizing throughput.
Core Workflow
- Define input, output, ordering, partial-result, and failure contracts.
- Prefer a synchronous or iterator API unless callers need channel mechanics.
- Assign ownership of goroutines, channel closure, timers, and cancellation.
- Bound concurrency, queues, retries, and memory together.
- Make every blocking send, receive, and wait cancellation-aware.
- Join all owned goroutines on success, failure, cancellation, and early exit.
- Test lifecycle behavior with barriers and deadlines rather than sleeps.
- Review shared maps, slices, locks, wait groups, and copied synchronization values.
- Run race checks and inspect leak-prone paths.
Read Next
| Task | Load |
|---|---|
| Design a pipeline | guidelines.md, workflows/design-cancellable-pipeline.md |
| Review goroutine ownership | workflows/review-goroutine-lifecycle.md |
| Test concurrency deterministically | workflows/test-concurrency-contract.md |
| Choose channels, iterators, buffers, or ordering | references/concurrency-pipelines/knowledge.md, references/concurrency-pipelines/rules.md |
| Review mutexes, WaitGroup, errgroup, or shared collections | references/concurrency-pipelines/rules.md, references/concurrency-pipelines/examples.md |
| Review patterns | references/concurrency-pipelines/examples.md |
Guardrails
- Only a sender that owns completion closes a channel.
- Do not use a buffer as a substitute for cancellation and joining.
- Do not expose internal channels when an iterator or synchronous result suffices.
- Do not assume
selectguarantees fairness. - Do not multiply a concurrency limit through hidden retries or nested fan-out.
- Do not prove timing behavior with arbitrary sleeps.
- Do not copy values containing mutexes, wait groups, conditions, or other sync state.
- Do not detach work from a request without a new bound, owner, error sink, and join policy.
Source Notes
Guidance is transformed and paraphrased from Inanc Gumus, *Go by Example:
Programmer's Guide to Idiomatic and Testable Programs* (Manning, 2025),
Chapters 6-7 and Appendix E. Examples are original.
Synchronization, context, and shared-collection guidance also incorporates
transformed material from Teiva Harsanyi, *100 Go Mistakes and How to Avoid
Them* (Manning, 2022), Chapters 8-9.
Book: https://www.manning.com/books/go-by-example
Verify language and API behavior against https://go.dev/ref/spec,
https://pkg.go.dev/context, https://pkg.go.dev/iter, and
https://go.dev/doc/articles/race_detector.
想直接用这个技能?
本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。
它属于哪个仓库
plugins/LVTD-LLC/skills/skills/go-concurrency-pipelines/SKILL.md