refactor: simplify code
parent
8e7af5891a
commit
1ae88df550
|
@ -261,9 +261,7 @@ func scanRun(opts *pkg.ScanOptions) error {
|
|||
|
||||
validOutput := false
|
||||
for _, o := range opts.Output {
|
||||
selectedOutput := output.GetOutput(o, opts.Quiet)
|
||||
err = selectedOutput.Write(analysis)
|
||||
if err != nil {
|
||||
if err = output.GetOutput(o, opts.Quiet).Write(analysis); err != nil {
|
||||
logrus.Errorf("Computing output %s://%s failed: %v", o.Key, o.Options["path"], err.Error())
|
||||
continue
|
||||
}
|
||||
|
@ -273,8 +271,7 @@ func scanRun(opts *pkg.ScanOptions) error {
|
|||
// Fallback to console output if all output failed
|
||||
if !validOutput {
|
||||
logrus.Debug("All outputs failed to compute, fallback to console output")
|
||||
err = output.NewConsole().Write(analysis)
|
||||
if err != nil {
|
||||
if err = output.NewConsole().Write(analysis); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue