cleanup: address ifshort linter issues

This commit addresses ifshort linter issues which
checks if short syntax for if-statements is possible.

updates: #1586

Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
Rakshith R
2021-05-06 15:19:27 +05:30
committed by mergify[bot]
parent 6618e2012d
commit b891e5585d
9 changed files with 10 additions and 19 deletions

View File

@ -47,9 +47,8 @@ func RoundOffVolSize(size int64) int64 {
// size less than 1MiB will be round off to 1MiB.
func RoundOffBytes(bytes int64) int64 {
var num int64
floatBytes := float64(bytes)
// round off the value if its in decimal
if floatBytes < helpers.GiB {
if floatBytes := float64(bytes); floatBytes < helpers.GiB {
num = int64(math.Ceil(floatBytes / helpers.MiB))
num *= helpers.MiB
} else {
@ -142,8 +141,7 @@ func ValidateDriverName(driverName string) error {
// 'utsname' structs 'release' component.
func GetKernelVersion() (string, error) {
utsname := unix.Utsname{}
err := unix.Uname(&utsname)
if err != nil {
if err := unix.Uname(&utsname); err != nil {
return "", err
}
return strings.TrimRight(string(utsname.Release[:]), "\x00"), nil