Remix.run Logo
bombela 5 days ago

It happens all the time sadly.

It's not because people intentionally write this way. A function takes a parameter (a Go slice for example) and calls another function and so one. Deep down a function copies the pointer to the slice (via closure for example). And then a goroutine is spawned with this closure.

The most obvious mistakes are caught quickly. Buu sharing a memory address between two threads can happen very indirectly.

And somehow in Go, everybody feels incredibly comfortable spawning millions of coroutines/threads.