diff --git a/common/filesys.go b/common/filesys.go index 7ad617d..09ca334 100644 --- a/common/filesys.go +++ b/common/filesys.go @@ -5,7 +5,7 @@ import "os" func WriteFile(path string, mustNotExist bool, append bool, data []byte) (error) { flag := os.O_CREATE | os.O_WRONLY if mustNotExist { flag |= os.O_EXCL } - if append { flag |= os.O_APPEND } + if append { flag |= os.O_APPEND } else { flag |= os.O_TRUNC } f, err := os.OpenFile(path, flag, os.ModePerm) f.Stat() if err != nil { return err }