feat(scan): add -wordpress-only and -libs-only flag (#898)

This commit is contained in:
Kota Kanbe
2019-09-06 10:33:03 +09:00
committed by GitHub
parent 69b6d875e6
commit b7ca5e5590
9 changed files with 47 additions and 23 deletions

View File

@@ -748,11 +748,16 @@ func setupChangelogCache() error {
// GetScanResults returns ScanResults from
func GetScanResults(scannedAt time.Time, timeoutSec int) (results models.ScanResults, err error) {
parallelExec(func(o osTypeInterface) (err error) {
if err = o.preCure(); err != nil {
return err
}
if err = o.scanPackages(); err != nil {
return err
if !(config.Conf.LibsOnly || config.Conf.WordPressOnly) {
if err = o.preCure(); err != nil {
return err
}
if err = o.scanPackages(); err != nil {
return err
}
if err = o.postScan(); err != nil {
return err
}
}
if err = o.scanWordPress(); err != nil {
return xerrors.Errorf("Failed to scan WordPress: %w", err)
@@ -760,7 +765,7 @@ func GetScanResults(scannedAt time.Time, timeoutSec int) (results models.ScanRes
if err = o.scanLibraries(); err != nil {
return xerrors.Errorf("Failed to scan Library: %w", err)
}
return o.postScan()
return nil
}, timeoutSec)
hostname, _ := os.Hostname()