Experimenting in Golang with atomic variables and wait groups to achieve concurrency without race conditions.
A similar, less finicky solution could be achieved with the sync
package using mutexes. Yet to benchmark speed differences for this specific scenario.