Truncate when writing

This commit is contained in:
obscuren committed 2014-09-17 15:57:07 +02:00
1 parent 1549a29c9d
commit fd041d91ee
1 file changed
+1 -1
+1 -1
View File
@@ -45,7 +45,7 @@ func ReadAllFile(filePath string) (string, error) {
}
func WriteFile(filePath string, content []byte) error {
fh, err := os.OpenFile(filePath, os.O_RDWR|os.O_CREATE, os.ModePerm)
fh, err := os.OpenFile(filePath, os.O_TRUNC|os.O_RDWR|os.O_CREATE, os.ModePerm)
if err != nil {
return err
}