[BreakingChange]Remove models.ScanHistory

This commit is contained in:
Kota Kanbe
2017-04-27 19:19:14 +09:00
committed by kota kanbe
parent bb708db89f
commit ec092501c3
5 changed files with 33 additions and 47 deletions

View File

@@ -152,14 +152,14 @@ func (p *TuiCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) s
return subcommands.ExitFailure
}
history, err := loadOneScanHistory(jsonDir)
results, err := loadScanResults(jsonDir)
if err != nil {
log.Errorf("Failed to read from JSON: %s", err)
return subcommands.ExitFailure
}
var results []models.ScanResult
for _, r := range history.ScanResults {
var filledResults []models.ScanResult
for _, r := range results {
if p.refreshCve || needToRefreshCve(r) {
if c.Conf.CveDBType == "sqlite3" {
if _, err := os.Stat(c.Conf.CveDBPath); os.IsNotExist(err) {
@@ -179,11 +179,10 @@ func (p *TuiCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) s
log.Errorf("Failed to write JSON: %s", err)
return subcommands.ExitFailure
}
results = append(results, *filled)
filledResults = append(filledResults, *filled)
} else {
results = append(results, r)
filledResults = append(filledResults, r)
}
}
history.ScanResults = results
return report.RunTui(history)
return report.RunTui(filledResults)
}