From b1a21df313f32deacb71a77772fc14d8e4a45b47 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sat, 19 Sep 2020 08:38:29 -0400 Subject: cedar.go: add writeFile --- cedar.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cedar.go b/cedar.go index 496584c..501cc1f 100644 --- a/cedar.go +++ b/cedar.go @@ -79,6 +79,19 @@ func readFile(f *os.File) ([]byte, error) { return bs, nil } +func writeFile(f os.File, cache Ids) error { + bs, err := json.Marshal(cache) + if err != nil { + return err + } + + n, err := f.Write(bs) + if n != len(bs) { + return err + } + return nil +} + func cacheFor(section string) (Ids, error) { cache := make(Ids, 0) -- cgit v1.2.3