- // We must create the file first or deployFile() will abort
- f, err := os.Create(dstPath)
+ // We must create the file first or deployFile() will abort; this is
+ // ugly because deployFile() already performs an atomic replacement
+ // but the simplest solution with the least duplicate code
+ f, err := renameio.TempFile(filepath.Dir(dstPath), dstPath)