make a map[] for tracking PB changes

This commit is contained in:
Jeff Carr 2025-09-13 00:52:16 -05:00
parent d158e4cb11
commit aea63ab19c
1 changed files with 21 additions and 0 deletions

21
changed.go Normal file
View File

@ -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]
}