X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=main.go;h=52727408962b0030baef955f4c679131e32ad734;hb=b8abeed6c7bddb9d9770f3be93dc41400354783b;hp=7a8755cac1df9d5cd4ffd2ff259b2e15c4e95b07;hpb=61a186321612e50e2c0224ca84c77434d3c42722;p=nsscash%2Fnsscash.git diff --git a/main.go b/main.go index 7a8755c..5272740 100644 --- a/main.go +++ b/main.go @@ -61,7 +61,9 @@ func main() { if err != nil { log.Fatal(err) } - err = WriteStateIfChanged(cfg.StatePath, state) + // NOTE: Make sure to call WriteState() only if there were no + // errors (see WriteState() and README) + err = WriteState(cfg.StatePath, state) if err != nil { log.Fatal(err) } @@ -94,6 +96,15 @@ func main() { if err != nil { log.Fatal(err) } + } else if t == FileTypeGroup { + grs, err := ParseGroups(bytes.NewReader(src)) + if err != nil { + log.Fatal(err) + } + err = SerializeGroups(&x, grs) + if err != nil { + log.Fatal(err) + } } else { log.Fatalf("unsupported file type %v", t) }