News for hackers. Stuff that matters.
Re:Updating the Go Memory Model by Philip-J-Fry on Monday July 12, 2021 @12:04PM (#27811663)
I don't use any of them services, but any config that has multiple readers and a single writer (who updates it when it changes) can just be protected by a sync.RWMutex.

The easiest thing to do would be to add a RWMutex to your Config struct. Then have public accessor methods which RLock the mutex while retrieving a field value.

Then when you want to update the config have something like a `Set(c Config)` method which allows you to overwrite the config stored in pointer. This Locks the RWMutex for writing of course.

There are no comments on this comment yet.