Begin to overhaul config to couple initialization logic closer to the structs themselves.

This commit is contained in:
Anna Rose Wiggins 2025-08-11 12:38:07 -04:00
parent d9babf5dc0
commit 1b374bccc6
15 changed files with 122 additions and 33 deletions

View file

@ -0,0 +1,19 @@
package configparser
import "slices"
// validateModes checks the provided modes against a larger subset of modes (usually all defined ones)
// and returns false if any of the modes are not defined.
func validateModes(modes []string, allModes []string) bool {
if len(modes) == 0 {
return true
}
for _, mode := range modes {
if !slices.Contains(allModes, mode) {
return false
}
}
return true
}