mirror of
https://github.com/mjl-/mox.git
synced 2024-12-28 01:13:47 +03:00
5c33640aea
sooner or later, someone will notice one of these messages, which will lead us to a bug.
18 lines
324 B
Go
18 lines
324 B
Go
package moxio
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
// SyncDir opens a directory and syncs its contents to disk.
|
|
func SyncDir(dir string) error {
|
|
d, err := os.Open(dir)
|
|
if err != nil {
|
|
return fmt.Errorf("open directory: %v", err)
|
|
}
|
|
err = d.Sync()
|
|
xerr := d.Close()
|
|
xlog.Check(xerr, "closing directory after sync")
|
|
return err
|
|
}
|