That's still a data race. Are you using the race detector?

On Mon, Sep 12, 2016 at 9:04 AM, sqweek E. <sqw...@gmail.com> wrote:
> Yes, through plain assignment. What problems arise from that?
>
> On Monday, September 12, 2016 at 11:21:05 PM UTC+8, Peter Bourgon wrote:
>>
>> How are you replacing the reference to the original map? If you're
>> just using plain assignment e.g. x.myMap = newMap then that's not
>> safe. You could use sync/atomic.Value if you always made sure to do
>> map reads via the Load method.
>>
>> On Mon, Sep 12, 2016 at 5:04 PM, sqweek E. <sqw...@gmail.com> wrote:
>> > instead of updating the maps in place, they (a) take a
>> > copy of the current map (b) update the copy and (c) replace the
>> > reference to
>> > the original map (held in a struct field) with the updated copy.
>>
> --
> 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 https://groups.google.com/d/optout.

-- 
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 https://groups.google.com/d/optout.

Reply via email to