summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-13 00:52:16 -0500
committerJeff Carr <[email protected]>2025-09-13 00:52:16 -0500
commitaea63ab19c955a222ff9cecc4dcb9878a8bcef65 (patch)
tree728d67a48ddf0642f5f88946c757dbe71a3a1003
parentd158e4cb11ae3f1dff4cf3917085adee1f5d9673 (diff)
make a map[] for tracking PB changes
-rw-r--r--changed.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/changed.go b/changed.go
new file mode 100644
index 0000000..18c6ab9
--- /dev/null
+++ b/changed.go
@@ -0,0 +1,21 @@
+package config
+
+// 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
+
+func init() {
+ // init() should be avoided, but this package and for making
+ // this small string map, it seems a sensible exception
+ saveMap = make(map[string]bool)
+}
+
+func SetChanged(name string, b bool) {
+ saveMap[name] = b
+}
+
+func HasChanged(name string) bool {
+ return saveMap[name]
+}