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