5 ms·
If you're accessing mutable data from multiple goroutines, then you're not only using channels! :)
by dilap 10y ago
If you're accessing mutable data from multiple goroutines, then you're not only using channels! :)
- masklinn 10y agoOf course you are. Go has essentially no support for immutable data structures, and even if you send large structures by value (which can get expensive) they themselves probably embed pointers to mutable data, and you're back at square one.
- dilap 10y agoI didn't say it was a good idea (in fact, if you read far enough back up the comment chain, you'll see I was saying it's a bad idea), but you could, if you wanted to, restrict yourself to only communicating between goroutines via channels of immutable data and be confident that your code had no data races.