diff --git a/cmd/skopeo/sync.go b/cmd/skopeo/sync.go index 82f9c9a1..e57e2828 100644 --- a/cmd/skopeo/sync.go +++ b/cmd/skopeo/sync.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "io" + "io/fs" "os" "path" "path/filepath" @@ -258,11 +259,11 @@ func imagesToCopyFromRepo(sys *types.SystemContext, repoRef reference.Named) ([] // and any error encountered. func imagesToCopyFromDir(dirPath string) ([]types.ImageReference, error) { var sourceReferences []types.ImageReference - err := filepath.Walk(dirPath, func(path string, info os.FileInfo, err error) error { + err := filepath.WalkDir(dirPath, func(path string, d fs.DirEntry, err error) error { if err != nil { return err } - if !info.IsDir() && info.Name() == "manifest.json" { + if !d.IsDir() && d.Name() == "manifest.json" { dirname := filepath.Dir(path) ref, err := directory.Transport.ParseReference(dirname) if err != nil { diff --git a/integration/copy_test.go b/integration/copy_test.go index 204c9067..4fdd2cca 100644 --- a/integration/copy_test.go +++ b/integration/copy_test.go @@ -6,6 +6,7 @@ import ( "crypto/x509" "encoding/json" "fmt" + "io/fs" "log" "net/http" "net/http/httptest" @@ -831,15 +832,15 @@ func (s *CopySuite) TestCopyCompression(c *check.C) { func findRegularFiles(c *check.C, root string) []string { result := []string{} - err := filepath.Walk(root, filepath.WalkFunc(func(path string, info os.FileInfo, err error) error { + err := filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error { if err != nil { return err } - if info.Mode().IsRegular() { + if d.Type().IsRegular() { result = append(result, path) } return nil - })) + }) c.Assert(err, check.IsNil) return result } diff --git a/integration/sync_test.go b/integration/sync_test.go index fb7c1f5c..39d7f48e 100644 --- a/integration/sync_test.go +++ b/integration/sync_test.go @@ -3,6 +3,7 @@ package main import ( "context" "fmt" + "io/fs" "os" "path" "path/filepath" @@ -102,11 +103,11 @@ func (s *SyncSuite) TearDownSuite(c *check.C) { func assertNumberOfManifestsInSubdirs(c *check.C, dir string, expectedCount int) { nManifests := 0 - err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { + err := filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error { if err != nil { return err } - if !info.IsDir() && info.Name() == "manifest.json" { + if !d.IsDir() && d.Name() == "manifest.json" { nManifests++ return filepath.SkipDir }