cleanup: resolve nlreturn linter issues

nlreturn linter requires a new line before return
and branch statements except when the return is alone
inside a statement group (such as an if statement) to
increase code clarity. This commit addresses such issues.

Updates: #1586

Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
Rakshith R
2021-07-22 11:15:17 +05:30
committed by mergify[bot]
parent 5c016b4b94
commit 43f753760b
74 changed files with 716 additions and 0 deletions

View File

@ -52,6 +52,7 @@ func ExecCommand(ctx context.Context, program string, args ...string) (string, s
if ctx != context.TODO() {
UsefulLog(ctx, "%s", err)
}
return stdout, stderr, err
}
@ -98,6 +99,7 @@ func GetPoolName(monitors string, cr *Credentials, poolID int64) (string, error)
} else if err != nil {
return "", fmt.Errorf("failed to get pool ID %d: %w", poolID, err)
}
return name, nil
}
@ -136,6 +138,7 @@ func CreateObject(ctx context.Context, monitors string, cr *Credentials, poolNam
if errors.Is(err, ErrPoolNotFound) {
err = JoinErrors(ErrObjectNotFound, err)
}
return err
}
defer ioctx.Destroy()
@ -149,6 +152,7 @@ func CreateObject(ctx context.Context, monitors string, cr *Credentials, poolNam
return JoinErrors(ErrObjectExists, err)
} else if err != nil {
ErrorLog(ctx, "failed creating omap (%s) in pool (%s): (%v)", objectName, poolName, err)
return err
}
@ -170,6 +174,7 @@ func RemoveObject(ctx context.Context, monitors string, cr *Credentials, poolNam
if errors.Is(err, ErrPoolNotFound) {
err = JoinErrors(ErrObjectNotFound, err)
}
return err
}
defer ioctx.Destroy()
@ -183,6 +188,7 @@ func RemoveObject(ctx context.Context, monitors string, cr *Credentials, poolNam
return JoinErrors(ErrObjectNotFound, err)
} else if err != nil {
ErrorLog(ctx, "failed removing omap (%s) in pool (%s): (%v)", oMapName, poolName, err)
return err
}