Re: [go-nuts] Re: Efficient ForEach() on a map protected by a mutex

2017-01-12 Thread Dragos Harabor
On Wednesday, January 11, 2017 at 11:08:37 PM UTC-8, tsuna wrote: > > On Sun, Jan 8, 2017 at 8:42 AM, Dragos Harabor > wrote: > > You can compile/run with -race : > > https://golang.org/doc/articles/race_detector.html > > Yes I’m very familiar with this, thank you, but the race detector > doe

[go-nuts] Re: Efficient ForEach() on a map protected by a mutex

2017-01-12 Thread Egon
On Saturday, 7 January 2017 03:12:54 UTC+2, tsuna wrote: > > > Is there a better way? > It depends on the problem being solved by the map. And on all the different statistics: R/W ratio, key and value types, map size, what *fn* does etc. etc. + Egon > -- You received this message because y

Re: [go-nuts] Re: Efficient ForEach() on a map protected by a mutex

2017-01-11 Thread tsuna
On Sun, Jan 8, 2017 at 8:42 AM, Dragos Harabor wrote: > You can compile/run with -race : > https://golang.org/doc/articles/race_detector.html Yes I’m very familiar with this, thank you, but the race detector doesn’t guarantee your code is correct, and it’s hard to run in production due to the ins

Re: [go-nuts] Re: Efficient ForEach() on a map protected by a mutex

2017-01-08 Thread Dragos Harabor
You can compile/run with -race : https://golang.org/doc/articles/race_detector.html On Saturday, January 7, 2017 at 11:59:40 PM UTC-8, tsuna wrote: > > On Sat, Jan 7, 2017 at 7:00 PM, 'Keith Randall' via golang-nuts < > golan...@googlegroups.com > wrote: > >> >> >> On Friday, January 6, 2017 at 5:

Re: [go-nuts] Re: Efficient ForEach() on a map protected by a mutex

2017-01-07 Thread tsuna
On Sat, Jan 7, 2017 at 7:00 PM, 'Keith Randall' via golang-nuts < golang-nuts@googlegroups.com> wrote: > > > On Friday, January 6, 2017 at 5:12:54 PM UTC-8, tsuna wrote: >> >> Hi there, >> I have a struct that contains an unexported map protected by a mutex, >> let’s say something like: >> >> type

[go-nuts] Re: Efficient ForEach() on a map protected by a mutex

2017-01-07 Thread 'Keith Randall' via golang-nuts
On Friday, January 6, 2017 at 5:12:54 PM UTC-8, tsuna wrote: > > Hi there, > I have a struct that contains an unexported map protected by a mutex, > let’s say something like: > > type Map struct { > mtx sync.Mutex > col map[string]interface{} > } > > I want to implement a ForEach method that wor