Browse code

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 <fcarriedo@gmail.com> (github: fcarriedo)

Francisco Carriedo authored on 2014/07/24 15:53:16
Showing 1 changed files
... ...
@@ -19,10 +19,9 @@ func init() {
19 19
 // HumanSize returns a human-readable approximation of a size
20 20
 // using SI standard (eg. "44kB", "17MB")
21 21
 func HumanSize(size int64) string {
22
-	i := 0
23
-	var sizef float64
24
-	sizef = float64(size)
25 22
 	units := []string{"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"}
23
+	i := 0
24
+	sizef := float64(size)
26 25
 	for sizef >= 1000.0 {
27 26
 		sizef = sizef / 1000.0
28 27
 		i++