Add blank case for convertUnit
Assumes that it's in bytes. On my system (Arch Linux), values of 0 have no unit printed next to them.
This commit is contained in:
parent
fb8165fa80
commit
d621f8d765
@ -23,8 +23,10 @@ func convertUnit(stringUnit string) (jsh.Unit, error) {
|
|||||||
return jsh.GB, nil
|
return jsh.GB, nil
|
||||||
case "tB":
|
case "tB":
|
||||||
return jsh.TB, nil
|
return jsh.TB, nil
|
||||||
|
case "":
|
||||||
|
return jsh.B, nil
|
||||||
default:
|
default:
|
||||||
return 0, errors.New(fmt.Sprintln("Unknown unit %s", stringUnit))
|
return 0, errors.New(fmt.Sprintf("Unknown unit: %s\n", stringUnit))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user