Menu

Go concurrency distilled
πŸ“°

Go concurrency distilled

Hacker NewsΒ·28 days ago
#VRaxBjpA
#antonz#golang#concurrency#goroutines#channels
Reading 0:00
15s threshold

This mini-book provides a brief overview of many concurrency topics in Go. Each topic comes with interactive examples β€” feel free to experiment with them by changing the code and clicking Run . There's also a PDF version with static examples.

This is a quick refresher on Go concurrency, not a beginner's guide. If you want to learn concurrency from the ground up with practical exercises, check out my other book β€” Gist of Go: Concurrency .

The book is AI-free.

Goroutines β€’ Channels β€’ Select β€’ Pipelines β€’ Time β€’ Context β€’ Wait groups β€’ Data races β€’ Race conditions β€’ Mutexes β€’ Semaphores β€’ Signaling β€’ Run once β€’ Object pool β€’ Atomics β€’ Testing β€’ Scheduling β€’ Diagnostics β€’ Final thoughts

# Goroutines

The foundation of concurrency in Go is goroutines – functions started with the go keyword:

func main () { var wg sync . WaitGroup wg . Add ( 2 ) go func () { defer wg . Done () fmt . Println ( "worker 1" ) }() go func () { defer wg . Done () fmt . Println ( "worker 2" ) }() wg .…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.