refactor: simplify code

main
sundowndev 2021-07-29 12:43:01 +02:00
parent 8e7af5891a
commit 1ae88df550
1 changed files with 2 additions and 5 deletions

View File

@ -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
}
}