Comment by tym0
10 hours ago
We're heavy user of Go at work. Go also makes it way to easy to write bad concurrent code and hard to write good one.
Stick to err/wait group and go routines and it's OK. Any PR with a channel or mutex I'll assume the author made a mistake.
Asking as an outsider to Go. How do you communicate between threads without a channel or mutex?
Wait groups do use concurency primitives underneath. My point is that the primitives that go provides are too easy to use incorrectly. And the language makes it hard to build nice abstraction on top of them. So I generally steer people away from using them unless strictly necessary, channels in particular.
A goroutins shares memory so you can just share variables if you want. It is basically the same as any other language in this regard.
It's also just as easy to incorrectly share memory and cause race conditions. There's no protection against it and it violates memory safety.
1 reply →