crawshaw/jsonfile

`Write` is not power safe

doanac opened this issue · 0 comments

_, err = f.Write(b)

I think you need an f.Sync() called before you do a Close. The write/close operations on Linux can be down async while the os.Rename is synchronous. A really inconveniently timed power failure can result in the Rename operation pointing at garbage.