mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
26 lines
631 B
Go
26 lines
631 B
Go
package scope
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/anchore/imgbom/imgbom/scope/resolvers"
|
|
"github.com/anchore/stereoscope/pkg/file"
|
|
"github.com/anchore/stereoscope/pkg/image"
|
|
)
|
|
|
|
type FileResolver interface {
|
|
FilesByPath(paths ...file.Path) ([]file.Reference, error)
|
|
FilesByGlob(patterns ...string) ([]file.Reference, error)
|
|
}
|
|
|
|
func getFileResolver(img *image.Image, option Option) (FileResolver, error) {
|
|
switch option {
|
|
case SquashedScope:
|
|
return resolvers.NewImageSquashResolver(img)
|
|
case AllLayersScope:
|
|
return resolvers.NewAllLayersResolver(img)
|
|
default:
|
|
return nil, fmt.Errorf("bad option provided: %+v", option)
|
|
}
|
|
}
|