Goroutines
Goroutines are Go’s secret weapon — lightweight threads managed by the runtime. Spin up thousands of them without breaking a sweat.
go f(x, y, z)
That’s it. One keyword and f runs concurrently. The arguments (f, x, y, z) are evaluated in the current goroutine — execution of f happens in the new one.
Goroutines share the same address space, so if they touch shared memory you need to synchronize. The sync package covers that, but Go’s preferred tool is channels — you’ll see why shortly.
Try it: watch how “world” and “hello” interleave. The scheduler decides the order, and it can change each run.