@@ -36,7 +36,6 @@ import (
36
36
"github.com/GoogleContainerTools/kaniko/pkg/timing"
37
37
"github.com/docker/docker/pkg/archive"
38
38
v1 "github.com/google/go-containerregistry/pkg/v1"
39
- "github.com/karrick/godirwalk"
40
39
"github.com/moby/buildkit/frontend/dockerfile/dockerignore"
41
40
"github.com/moby/patternmatcher"
42
41
otiai10Cpy "github.com/otiai10/copy"
@@ -1262,7 +1261,7 @@ func gowalkDir(dir string, existingPaths map[string]struct{}, changeFunc func(st
1262
1261
foundPaths := make ([]string , 0 )
1263
1262
deletedFiles := existingPaths // Make a reference.
1264
1263
1265
- callback := func (path string , ent * godirwalk. Dirent ) error {
1264
+ callback := func (path string , ent fs. DirEntry , err error ) error {
1266
1265
logrus .Tracef ("Analyzing path '%s'" , path )
1267
1266
1268
1267
if IsInIgnoreList (path ) {
@@ -1285,11 +1284,7 @@ func gowalkDir(dir string, existingPaths map[string]struct{}, changeFunc func(st
1285
1284
return nil
1286
1285
}
1287
1286
1288
- godirwalk .Walk (dir ,
1289
- & godirwalk.Options {
1290
- Callback : callback ,
1291
- Unsorted : true ,
1292
- })
1287
+ filesystem .WalkDir (dir , callback )
1293
1288
1294
1289
return walkFSResult {foundPaths , deletedFiles }
1295
1290
}
@@ -1299,33 +1294,29 @@ func GetFSInfoMap(dir string, existing map[string]os.FileInfo) (map[string]os.Fi
1299
1294
fileMap := map [string ]os.FileInfo {}
1300
1295
foundPaths := []string {}
1301
1296
timer := timing .Start ("Walking filesystem with Stat" )
1302
- godirwalk .Walk (dir , & godirwalk.Options {
1303
- Callback : func (path string , ent * godirwalk.Dirent ) error {
1304
- if CheckCleanedPathAgainstIgnoreList (path ) {
1305
- if IsDestDir (path ) {
1306
- logrus .Tracef ("Skipping paths under %s, as it is a ignored directory" , path )
1307
- return filepath .SkipDir
1308
- }
1309
- return nil
1297
+ filesystem .WalkDir (dir , func (path string , ent fs.DirEntry , err error ) error {
1298
+ if CheckCleanedPathAgainstIgnoreList (path ) {
1299
+ if IsDestDir (path ) {
1300
+ logrus .Tracef ("Skipping paths under %s, as it is a ignored directory" , path )
1301
+ return filepath .SkipDir
1310
1302
}
1311
- if fi , err := filesystem .FS .Lstat (path ); err == nil {
1312
- if fiPrevious , ok := existing [path ]; ok {
1313
- // check if file changed
1314
- if ! isSame (fiPrevious , fi ) {
1315
- fileMap [path ] = fi
1316
- foundPaths = append (foundPaths , path )
1317
- }
1318
- } else {
1319
- // new path
1303
+ return nil
1304
+ }
1305
+ if fi , err := filesystem .FS .Lstat (path ); err == nil {
1306
+ if fiPrevious , ok := existing [path ]; ok {
1307
+ // check if file changed
1308
+ if ! isSame (fiPrevious , fi ) {
1320
1309
fileMap [path ] = fi
1321
1310
foundPaths = append (foundPaths , path )
1322
1311
}
1312
+ } else {
1313
+ // new path
1314
+ fileMap [path ] = fi
1315
+ foundPaths = append (foundPaths , path )
1323
1316
}
1324
- return nil
1325
- },
1326
- Unsorted : true ,
1327
- },
1328
- )
1317
+ }
1318
+ return nil
1319
+ })
1329
1320
timing .DefaultRun .Stop (timer )
1330
1321
return fileMap , foundPaths
1331
1322
}
0 commit comments