author | Alberto Bertogli
<albertito@blitiri.com.ar> 2016-09-18 05:04:31 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2016-10-09 23:51:03 UTC |
parent | 394067bbd3b489a6b8c10bb68b5a26e43dcff2ce |
internal/safeio/safeio.go | +3 | -1 |
diff --git a/internal/safeio/safeio.go b/internal/safeio/safeio.go index 127c506..e8cce16 100644 --- a/internal/safeio/safeio.go +++ b/internal/safeio/safeio.go @@ -17,7 +17,9 @@ import ( func WriteFile(filename string, data []byte, perm os.FileMode) error { // Note we create the temporary file in the same directory, otherwise we // would have no expectation of Rename being atomic. - tmpf, err := ioutil.TempFile(path.Dir(filename), path.Base(filename)) + // We make the file names start with "." so there's no confusion with the + // originals. + tmpf, err := ioutil.TempFile(path.Dir(filename), "."+path.Base(filename)) if err != nil { return err }