> I would like to CtxStarStore would be access globally. As a general principle, I'd say try to avoid such global state. Most data structures in go are not safe for concurrent access from multiple goroutines: not only maps, but even things like integers. Concurrent access to maps or slices can cause your program to panic.
Obviously there's the traditional solution of "use a mutex around all operations". There are also some safe structures like sync.Map. But it may be that there's a better pattern for your application. If you can invest the time in this video from Bryan C Mills - and it took me several views to get it fully - it's very much worth it: https://www.youtube.com/watch?v=5zXAHh5tJqQ One thing I learned from this is that you can keep data in a 1-element buffered channel, popping it out when you need to access it, and pushing it back in when you're done. > -- 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/1ecda1da-07d6-41a0-8d72-ec8193a66bcbn%40googlegroups.com.