Skip to content

Commit 345a8df

Browse files
authored
Merge pull request #7 from sourcegraph/nelsona/windows-no-fsync
Rename directories on Windows does not need syscall.Fsync() on rename.
2 parents 9e6dacd + 304e614 commit 345a8df

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

internal/fileutil/fileutil.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//go:build !windows
2+
// +build !windows
3+
14
package fileutil
25

36
import (

internal/fileutil/fileutil_windows.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//go:build windows
2+
// +build windows
3+
4+
package fileutil
5+
6+
import (
7+
"os"
8+
)
9+
10+
// RenameAndSync will do an os.Rename followed by fsync to ensure the rename
11+
// is recorded
12+
func RenameAndSync(oldpath, newpath string) error {
13+
return os.Rename(oldpath, newpath)
14+
}

0 commit comments

Comments
 (0)