From d512294382c9013dee2820745db02ab63dc2ecdd Mon Sep 17 00:00:00 2001 From: Francisco Carriedo Date: Wed, 23 Jul 2014 23:53:16 -0700 Subject: [PATCH] pkg/units: Compacted var declaration and initialization No need to have two lines. The type is even explicit when type casting to `float64(size)` Docker-DCO-1.1-Signed-off-by: Francisco Carriedo (github: fcarriedo) --- pkg/units/size.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/units/size.go b/pkg/units/size.go index 91b617634cf68..6535540ce2df7 100644 --- a/pkg/units/size.go +++ b/pkg/units/size.go @@ -19,10 +19,9 @@ func init() { // HumanSize returns a human-readable approximation of a size // using SI standard (eg. "44kB", "17MB") func HumanSize(size int64) string { - i := 0 - var sizef float64 - sizef = float64(size) units := []string{"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"} + i := 0 + sizef := float64(size) for sizef >= 1000.0 { sizef = sizef / 1000.0 i++