From 422ca0295ad4a4134531ee33dd997177c197c0aa Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Sat, 27 Dec 2025 02:09:00 -0500 Subject: [PATCH] Allow append mode when config cannot be loaded --- cfg/cfg.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cfg/cfg.go b/cfg/cfg.go index 73b00f1..e412b55 100644 --- a/cfg/cfg.go +++ b/cfg/cfg.go @@ -42,6 +42,7 @@ func LoadConfig() (*ConfigT, error) { // If used in append mode, any nil values in the // input cfg will be substituted with the existing values. func WriteConfig(cfg *ConfigT, appendMode bool) error { +start: if appendMode { // check if any fields are nil var hasNilFields bool @@ -58,7 +59,9 @@ func WriteConfig(cfg *ConfigT, appendMode bool) error { if hasNilFields { oldCfg, err := LoadConfig() if err != nil { - return err + // failed to load config, leave append mode + appendMode = false + goto start } oldValue := reflect.ValueOf(&oldCfg.Libmutton).Elem() for i := 0; i < cfgValue.NumField(); i++ {