Firstly, I have already read this How safe are Golang maps for concurrent Read/Write operations? and my question is not how safe golang maps are during read/write but a lot more specific. In multiple places in the above mentioned thread at SO, people have mentioned that Concurrent read from maps are still ok! and logically that should be the case but it turns out that there are some other resources as well where people mention golang maps are not even safe to read concurrently. For example take a look at the following resources
In one place https://groups.google.com/g/golang-nuts/c/_XHqFejikBg I saw people mentioned that reads are concurrent if it happens only after the initialisation of Maps. How sync.Map
is playing here? Why reads are not concurrent if each goroutines process for a single key but writes happens after the map is initialised via other goroutines? It shouldn't be the case because for each key hash is being calculated and for a given hash write/read never happens by any other goroutines.
Please help to explain it. Thanks