1---2name: li-lance-android-seraphim-framework-golang-concurrency3description: Golang Concurrency4---56# Golang Concurrency78## **Priority: P0 (CRITICAL)**910## Principles1112- **Share Memory by Communicating**: Use channels instead of shared memory.13- **Context is King**: Always pass `ctx` to manage cancellation/timeouts.14- **Prevent Leaks**: Never start a goroutine without knowing how it will stop.15- **Race Detection**: Always run tests with `go test -race`.1617## Implementation Workflow18191. **Choose primitive** — Channels for data passing, `sync.Mutex` for simple state protection,20 `errgroup` for parallel tasks with error handling.212. **Pass context** — Every goroutine that does I/O or long work must accept `context.Context`.223. **Define exit paths** — Every goroutine must have a clear shutdown mechanism (context23 cancellation, channel close, or WaitGroup).244. **Use select for multiplexing** — Handle multiple channels or timeouts with `select`.255. **Test with race detector** — Run `go test -race` in CI.2627See [ErrGroup and concurrency patterns](references/concurrency-patterns.md)28and [context timeout examples](references/context-usage.md)2930## Anti-Patterns3132- **No goroutine leaks**: Every goroutine must have a known exit path.33- **No shared global state**: Use channels or sync primitives across goroutines.34- **No bare goroutines**: Use `errgroup` or `WaitGroup` for lifecycle management.3536## References3738- [Concurrency Patterns](references/concurrency-patterns.md)39- [Context Usage](references/context-usage.md)4041---42> Source: [li-lance/android-seraphim-framework](https://github.com/li-lance/android-seraphim-framework) — distributed by [TomeVault](https://tomevault.io).43<!-- tomevault:4.0:skill_md:2026-06-16 -->
Run npx skillmds@latest add tomevault-io/li-lance-android-seraphim-framework-golang-concurrency in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Golang Concurrency It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
tomevault-io (@tomevault-io) published this skill. Their other Agent Skills are listed on their SkillMD profile.