@@ -3,7 +3,7 @@ package util_test
3
3
import (
4
4
"errors"
5
5
"fmt"
6
- "io/fs "
6
+ "os "
7
7
"path/filepath"
8
8
"reflect"
9
9
"testing"
@@ -23,19 +23,19 @@ var _ = Suite(&WalkSuite{})
23
23
24
24
func (s * WalkSuite ) TestWalkCanSkipTopDirectory (c * C ) {
25
25
filesystem := memfs .New ()
26
- c .Assert (util .Walk (filesystem , "/root/that/does/not/exist" , func (path string , info fs .FileInfo , err error ) error { return filepath .SkipDir }), IsNil )
26
+ c .Assert (util .Walk (filesystem , "/root/that/does/not/exist" , func (path string , info os .FileInfo , err error ) error { return filepath .SkipDir }), IsNil )
27
27
}
28
28
29
29
func (s * WalkSuite ) TestWalkReturnsAnErrorWhenRootDoesNotExist (c * C ) {
30
30
filesystem := memfs .New ()
31
- c .Assert (util .Walk (filesystem , "/root/that/does/not/exist" , func (path string , info fs .FileInfo , err error ) error { return err }), NotNil )
31
+ c .Assert (util .Walk (filesystem , "/root/that/does/not/exist" , func (path string , info os .FileInfo , err error ) error { return err }), NotNil )
32
32
}
33
33
34
34
func (s * WalkSuite ) TestWalkOnPlainFile (c * C ) {
35
35
filesystem := memfs .New ()
36
36
createFile (c , filesystem , "./README.md" )
37
37
discoveredPaths := []string {}
38
- c .Assert (util .Walk (filesystem , "./README.md" , func (path string , info fs .FileInfo , err error ) error {
38
+ c .Assert (util .Walk (filesystem , "./README.md" , func (path string , info os .FileInfo , err error ) error {
39
39
discoveredPaths = append (discoveredPaths , path )
40
40
return nil
41
41
}), IsNil )
@@ -47,7 +47,7 @@ func (s *WalkSuite) TestWalkOnExistingFolder(c *C) {
47
47
createFile (c , filesystem , "path/to/some/subfolder/that/contain/file" )
48
48
createFile (c , filesystem , "path/to/some/file" )
49
49
discoveredPaths := []string {}
50
- c .Assert (util .Walk (filesystem , "path" , func (path string , info fs .FileInfo , err error ) error {
50
+ c .Assert (util .Walk (filesystem , "path" , func (path string , info os .FileInfo , err error ) error {
51
51
discoveredPaths = append (discoveredPaths , path )
52
52
return nil
53
53
}), IsNil )
@@ -66,7 +66,7 @@ func (s *WalkSuite) TestWalkCanSkipFolder(c *C) {
66
66
createFile (c , filesystem , "path/to/some/subfolder/that/contain/file" )
67
67
createFile (c , filesystem , "path/to/some/file" )
68
68
discoveredPaths := []string {}
69
- c .Assert (util .Walk (filesystem , "path" , func (path string , info fs .FileInfo , err error ) error {
69
+ c .Assert (util .Walk (filesystem , "path" , func (path string , info os .FileInfo , err error ) error {
70
70
discoveredPaths = append (discoveredPaths , path )
71
71
if path == "path/to/some/subfolder" {
72
72
return filepath .SkipDir
@@ -88,7 +88,7 @@ func (s *WalkSuite) TestWalkStopsOnError(c *C) {
88
88
createFile (c , filesystem , "path/to/some/subfolder/that/contain/file" )
89
89
createFile (c , filesystem , "path/to/some/file" )
90
90
discoveredPaths := []string {}
91
- c .Assert (util .Walk (filesystem , "path" , func (path string , info fs .FileInfo , err error ) error {
91
+ c .Assert (util .Walk (filesystem , "path" , func (path string , info os .FileInfo , err error ) error {
92
92
discoveredPaths = append (discoveredPaths , path )
93
93
if path == "path/to/some/subfolder" {
94
94
return errors .New ("uncaught error" )
@@ -109,7 +109,7 @@ func (s *WalkSuite) TestWalkForwardsStatErrors(c *C) {
109
109
memFilesystem := memfs .New ()
110
110
filesystem := & fnFs {
111
111
Filesystem : memFilesystem ,
112
- lstat : func (path string ) (fs .FileInfo , error ) {
112
+ lstat : func (path string ) (os .FileInfo , error ) {
113
113
if path == "path/to/some/subfolder" {
114
114
return nil , errors .New ("uncaught error" )
115
115
}
@@ -120,7 +120,7 @@ func (s *WalkSuite) TestWalkForwardsStatErrors(c *C) {
120
120
createFile (c , filesystem , "path/to/some/subfolder/that/contain/file" )
121
121
createFile (c , filesystem , "path/to/some/file" )
122
122
discoveredPaths := []string {}
123
- c .Assert (util .Walk (filesystem , "path" , func (path string , info fs .FileInfo , err error ) error {
123
+ c .Assert (util .Walk (filesystem , "path" , func (path string , info os .FileInfo , err error ) error {
124
124
discoveredPaths = append (discoveredPaths , path )
125
125
if path == "path/to/some/subfolder" {
126
126
c .Assert (err , NotNil )
@@ -147,10 +147,10 @@ func createFile(c *C, filesystem billy.Filesystem, path string) {
147
147
148
148
type fnFs struct {
149
149
billy.Filesystem
150
- lstat func (path string ) (fs .FileInfo , error )
150
+ lstat func (path string ) (os .FileInfo , error )
151
151
}
152
152
153
- func (f * fnFs ) Lstat (path string ) (fs .FileInfo , error ) {
153
+ func (f * fnFs ) Lstat (path string ) (os .FileInfo , error ) {
154
154
if f .lstat != nil {
155
155
return f .lstat (path )
156
156
}
0 commit comments