[go-nuts] Re: question about golang concurrency

2018-01-08 Thread matthewjuran
This looks concurrency safe to me too. Here's style suggestions: Instead of type memoryCache struct { Data map[string]string mux sync.Mutex } You could have type memoryCache struct { Data map[string]string *sync.RWMutex } func (c memoryCache) Set(key string, val string) { defer c.Unlock

[go-nuts] Re: question about golang concurrency

2018-01-08 Thread jake6502
Your use of the sync.Mutex seems sound. At first glance, I see no concurrency problems. I would suggest running the program with the -race flag. If you make memoryCache a package, then perhaps a concurrent test that can be run with -race would also be good. In that case you may also want to co