Re: [go-nuts] Sharing data via Mutex vs. Channel

2018-10-24 Thread 'Reinhard Luediger' via golang-nuts
Thanks that sounds reasonable to me -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit

Re: [go-nuts] Sharing data via Mutex vs. Channel

2018-10-23 Thread Henrik Johansson
Mutexes aren't expensive when compared to channels. They are usually harder to get right and that's why there is the old Go mantra: "Don't communicate by sharing memory; instead, share memory by communicating." I would say you should use what fits the use case but prefer channels if possible.

[go-nuts] Sharing data via Mutex vs. Channel

2018-10-23 Thread 'Reinhard Luediger' via golang-nuts
Hi folks, somwhere on my golang journey ("don't k now where and when") I was teached that mutexes are very expensive and we should prefer to communicate over channels instead of working with mutexes. I trusted it until today. I explained it to our aprentice based on my knowledge and he asked