summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-13 01:47:08 -0500
committerJeff Carr <[email protected]>2025-09-13 01:47:08 -0500
commit1dfac22abcf26235c8b21dd2e394f657e06ed556 (patch)
tree87ae7ee2695a24d5e8f433ae478ccfba106385c3
parentaea63ab19c955a222ff9cecc4dcb9878a8bcef65 (diff)
amazing GO detection on needing a mutex. Very impressive!v0.0.3
-rw-r--r--changed.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/changed.go b/changed.go
index 18c6ab9..df955cb 100644
--- a/changed.go
+++ b/changed.go
@@ -1,10 +1,13 @@
package config
+import "sync"
+
// this package can provide a trivial way to track which
// protobufs have been modified and need to be written to disk
// todo: autogenpb could generate code to work with this
var saveMap map[string]bool
+var saveLock sync.Mutex
func init() {
// init() should be avoided, but this package and for making
@@ -13,6 +16,8 @@ func init() {
}
func SetChanged(name string, b bool) {
+ saveLock.Lock()
+ defer saveLock.Unlock()
saveMap[name] = b
}