golang-pitfalls-concurrency-foundations

Installation
SKILL.md

Golang Pitfalls: Concurrency Foundations

Source material: mistakes #55-60 from 100 Go Mistakes and How to Avoid Them (teivah/100-go-mistakes).

Apply these rules when reasoning about basic Go concurrency.

55. Mixing up concurrency and parallelism (#55)

  • Concurrency is about structure (breaking a problem into independently executible parts); parallelism is about execution (running parts at the same time).
  • Concurrency provides the structure that enables parallelism.

56. Thinking concurrency is always faster (#56)

  • Concurrency is not automatically faster. Creating goroutines and scheduling has costs.
  • Parallel merge sort on 4 cores, naively spawning goroutines for each half, was ~an order of magnitude slower than sequential for 10k elements.
  • The fix: only parallelize workloads above a threshold (e.g., a max slice size, benchmarked for your machine).
  • Validate assumptions with benchmarks and profiling; start sequential when unsure.

57. Being puzzled about channels vs. mutexes (#57)

Installs
2
First Seen
9 days ago
golang-pitfalls-concurrency-foundations — fabianoflorentino/golang-agent-skills