Make SizeSuffix output without b suffix for more useful printouts

This commit is contained in:
Nick Craig-Wood 2016-06-03 22:49:14 +01:00
parent 9bbcdeefd0
commit 772f99fd74
2 changed files with 2 additions and 2 deletions

View File

@ -108,7 +108,7 @@ func (x SizeSuffix) String() string {
return "0"
case x < 1024:
scaled = float64(x)
suffix = "b"
suffix = ""
case x < 1024*1024:
scaled = float64(x) / 1024
suffix = "k"

View File

@ -12,7 +12,7 @@ func TestSizeSuffixString(t *testing.T) {
want string
}{
{0, "0"},
{102, "102b"},
{102, "102"},
{1024, "1k"},
{1024 * 1024, "1M"},
{1024 * 1024 * 1024, "1G"},