feat(fs): allow scanning a single file (#1578)

Co-authored-by: knqyf263 <knqyf263@gmail.com>
This commit is contained in:
jerbob92
2022-01-16 15:32:31 +01:00
committed by GitHub
parent 7fcbf44bb8
commit b507360075
7 changed files with 136 additions and 33 deletions

View File

@@ -61,11 +61,11 @@ func initializeArchiveScanner(ctx context.Context, filePath string, artifactCach
return scannerScanner, nil
}
func initializeFilesystemScanner(ctx context.Context, dir string, artifactCache cache.ArtifactCache, localArtifactCache cache.LocalArtifactCache, artifactOption artifact.Option, configScannerOption config.ScannerOption) (scanner.Scanner, func(), error) {
func initializeFilesystemScanner(ctx context.Context, path string, artifactCache cache.ArtifactCache, localArtifactCache cache.LocalArtifactCache, artifactOption artifact.Option, configScannerOption config.ScannerOption) (scanner.Scanner, func(), error) {
applierApplier := applier.NewApplier(localArtifactCache)
detector := ospkg.Detector{}
localScanner := local.NewScanner(applierApplier, detector)
artifactArtifact, err := local2.NewArtifact(dir, artifactCache, artifactOption, configScannerOption)
artifactArtifact, err := local2.NewArtifact(path, artifactCache, artifactOption, configScannerOption)
if err != nil {
return scanner.Scanner{}, nil, err
}