refactor: do not silence errors on config sync

This commit is contained in:
Jan De Dobbeleer 2022-03-17 13:00:15 +01:00 committed by Jan De Dobbeleer
parent 0ec78b991c
commit c8068b9cb1

View file

@ -133,8 +133,14 @@ func (cfg *Config) sync() {
return
}
var structMap map[string]interface{}
inrec, _ := json2.Marshal(cfg)
_ = json2.Unmarshal(inrec, &structMap)
inrec, err := json2.Marshal(cfg)
if err != nil {
return
}
err = json2.Unmarshal(inrec, &structMap)
if err != nil {
return
}
// remove empty structs
for k, v := range structMap {
if smap, OK := v.(map[string]interface{}); OK && len(smap) == 0 {