mirror of
https://github.com/restic/restic.git
synced 2025-08-26 09:28:01 +00:00
fs: clean up helper functions
This commit is contained in:
@@ -446,7 +446,7 @@ func (arch *Archiver) save(ctx context.Context, snPath, target string, previous
|
||||
}
|
||||
|
||||
switch {
|
||||
case fs.IsRegularFile(fi):
|
||||
case fi.Mode().IsRegular():
|
||||
debug.Log(" %v regular file", target)
|
||||
|
||||
// check if the file has not changed before performing a fopen operation (more expensive, specially
|
||||
@@ -505,7 +505,7 @@ func (arch *Archiver) save(ctx context.Context, snPath, target string, previous
|
||||
}
|
||||
|
||||
// make sure it's still a file
|
||||
if !fs.IsRegularFile(fi) {
|
||||
if !fi.Mode().IsRegular() {
|
||||
err = errors.Errorf("file %v changed type, refusing to archive", fi.Name())
|
||||
_ = file.Close()
|
||||
err = arch.error(abstarget, err)
|
||||
|
@@ -169,7 +169,7 @@ func TestEnsureFiles(t testing.TB, target string, dir TestDir) {
|
||||
}
|
||||
return nil
|
||||
case TestFile:
|
||||
if !fs.IsRegularFile(fi) {
|
||||
if !fi.Mode().IsRegular() {
|
||||
t.Errorf("is not a regular file: %v", path)
|
||||
return nil
|
||||
}
|
||||
@@ -208,7 +208,7 @@ func TestEnsureFiles(t testing.TB, target string, dir TestDir) {
|
||||
})
|
||||
|
||||
// then, traverse the directory again, looking for additional files
|
||||
err := fs.Walk(target, func(path string, fi os.FileInfo, err error) error {
|
||||
err := filepath.Walk(target, func(path string, fi os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@@ -122,7 +122,7 @@ func TestTestCreateFiles(t *testing.T) {
|
||||
|
||||
switch node := item.(type) {
|
||||
case TestFile:
|
||||
if !fs.IsRegularFile(fi) {
|
||||
if !fi.Mode().IsRegular() {
|
||||
t.Errorf("is not regular file: %v", name)
|
||||
continue
|
||||
}
|
||||
|
Reference in New Issue
Block a user