github.com/noqcks/syft@v0.0.0-20230920222752-a9e2c4e288e5/syft/file/cataloger/internal/all_regular_files.go (about) 1 package internal 2 3 import ( 4 stereoscopeFile "github.com/anchore/stereoscope/pkg/file" 5 "github.com/anchore/syft/internal/log" 6 "github.com/anchore/syft/syft/file" 7 ) 8 9 func AllRegularFiles(resolver file.Resolver) (locations []file.Location) { 10 for location := range resolver.AllLocations() { 11 resolvedLocations, err := resolver.FilesByPath(location.RealPath) 12 if err != nil { 13 log.Warnf("unable to resolve %+v: %+v", location, err) 14 continue 15 } 16 17 for _, resolvedLocation := range resolvedLocations { 18 metadata, err := resolver.FileMetadataByLocation(resolvedLocation) 19 if err != nil { 20 log.Warnf("unable to get metadata for %+v: %+v", location, err) 21 continue 22 } 23 24 if metadata.Type != stereoscopeFile.TypeRegular { 25 continue 26 } 27 locations = append(locations, resolvedLocation) 28 } 29 } 30 return locations 31 }