Add thread safety to all koanf public methods
This PR addresses the concerns brought up in Issue #355 and previously in Issue #153.
Since the koanf.confMap is a shared resource that could be accessed concurrently from different goroutines for reading/updating config values, the solution is to acquire and release a sync.RWMutex in each public method that accesses the confMap property.
A more robust and performant solution would be to refactor the existing koanf.confMap map property and all methods in "github.com/knadh/koanf/maps" to use the inherently thread safe sync.Map structure from the standard library. This approach would remove the overhead of adding RWMutex locking to any new public methods and provide more granular read locking in the case of many concurrent read operations where the current approach locks the entire map structure for each read. The obvious downside is that it would require a much more intensive refactor.
Looks like the mutex is causing a deadlock: https://github.com/knadh/koanf/actions/runs/13138967660/job/36969992725?pr=339
Looks like the mutex is causing a deadlock: https://github.com/knadh/koanf/actions/runs/13138967660/job/36969992725?pr=339
Good call. I'll dig into this to see where I messed up and will be sure to write some unit tests to prove that it works as intended (will try to use Go's Data Race Detector) before officially opening the PR.
Closing this in favour of #377