From 0798ba6602767f21cc280472d6d162589d05d31d Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sat, 17 Dec 2022 22:45:30 +0400 Subject: [PATCH] convertFileSize() now returns only a concatination of a converted size and a size unit. --- pkg/files/filesize.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/files/filesize.go b/pkg/files/filesize.go index 522497a..d3f7f2c 100644 --- a/pkg/files/filesize.go +++ b/pkg/files/filesize.go @@ -8,8 +8,8 @@ import ( var sizeSuffixes = [...]string{"B", "KiB", "MiB", "GiB", "TiB"} // convertFileSize converts size in bytes down to biggest units it represents. -// Returns converted size, unit and, a concatenation of size and unit -func convertFileSize(size int64) (float64, string, string) { +// Returns a concatenation of a converted size and a unit +func convertFileSize(size int64) string { var idx int var fSize float64 = float64(size) for idx = 0; fSize >= 1024; fSize /= 1024 { @@ -18,5 +18,5 @@ func convertFileSize(size int64) (float64, string, string) { fSizeStr := strconv.FormatFloat(fSize, 'f', 3, 64) fSizeStr = strings.TrimRight(fSizeStr, "0") fSizeStr = strings.TrimSuffix(fSizeStr, ".") - return fSize, sizeSuffixes[idx], fSizeStr + " " + sizeSuffixes[idx] + return fSizeStr + " " + sizeSuffixes[idx] }