On 27/06/21, Brian Candler (b.cand...@pobox.com) wrote: > > Shouldn't that result in a panic, even without -race? > > It's not *guaranteed* to panic when you make concurrent accesses to the > same map (hence the point of the race checker). And having two structs > refer to the same map is no different to having two variables refer to the > same map. > > For the OP: one way you could see this problem is if you ever copy > SearchResults by value: > https://play.golang.org/p/LqwXQQzQ4VN > > Note the "go vet" warning here. Have you tried running "go vet" on your > code?
Thanks for the very useful example. I have completely overlooked the use of go vet, which has found a bunch of "copies lock" and "passes lock by value" errors. Rory -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/20210627103621.GA7209%40campbell-lange.net.