diff --git a/src/cmds/restic/integration_helpers_test.go b/src/cmds/restic/integration_helpers_test.go index ca7abec5c..6274129ca 100644 --- a/src/cmds/restic/integration_helpers_test.go +++ b/src/cmds/restic/integration_helpers_test.go @@ -35,21 +35,10 @@ func walkDir(dir string) <-chan *dirEntry { return nil } - links := 1 - if runtime.GOOS != "windows" { - stat, ok := restic.ToStatT(info.Sys()) - - if !ok { - return nil - } - - links = stat.nlink() - } - ch <- &dirEntry{ path: name, fi: info, - link: links, + link: nlink(), } return nil diff --git a/src/cmds/restic/integration_helpers_unix_test.go b/src/cmds/restic/integration_helpers_unix_test.go index 01c33c7af..0f7a80a04 100644 --- a/src/cmds/restic/integration_helpers_unix_test.go +++ b/src/cmds/restic/integration_helpers_unix_test.go @@ -6,6 +6,7 @@ import ( "fmt" "os" "syscall" + "restic" ) func (e *dirEntry) equals(other *dirEntry) bool { @@ -44,3 +45,11 @@ func (e *dirEntry) equals(other *dirEntry) bool { return true } + +func nlink(info os.FileInfo) (uint64, error) { + stat, err := restic.ToStatT(info.Sys()) + if err { + return nil, ok + } + return stat.nlink(info), err +} \ No newline at end of file diff --git a/src/cmds/restic/integration_helpers_windows_test.go b/src/cmds/restic/integration_helpers_windows_test.go index d67e9ca11..fd11f17f9 100644 --- a/src/cmds/restic/integration_helpers_windows_test.go +++ b/src/cmds/restic/integration_helpers_windows_test.go @@ -25,3 +25,7 @@ func (e *dirEntry) equals(other *dirEntry) bool { return true } + +func nlink(info os.FileInfo) (uint64, error) { + return 1, err +} \ No newline at end of file