I've a few Actors in my Golang App which require two maps to do their work. Those maps are generated by some intensive database transactions so I don't want to do that in every actor, as a result I've separated the maps generation from the Actors.
The issue that I'm having with this approach is that if I pass those maps to every single one of them they are passed by reference which causes panic as I'm writing and reading concurrently.
My solution to that was to Marshal and Unmarshal those maps every time those are passed to a new Actor, but I want to know if there is a better solution to that.