Goroutines in Go

From the Go cheat sheet · Concurrency · verified Jul 2026

Goroutines

Concurrent execution with goroutines

go
// Start goroutine
go doSomething()

// Anonymous goroutine
go func() {
    fmt.Println("Hello from goroutine")
}()

// Wait for completion
time.Sleep(time.Second)
🚀 Lightweight threads managed by Go runtime
⚡ Can run millions of goroutines
🔄 Use sync.WaitGroup for synchronization
⚠️ Beware of race conditions - use channels or mutexes

More Go tasks

Back to the full Go cheat sheet