瀏覽代碼

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 11 年之前
父節點
當前提交
d512294382
共有 1 個文件被更改,包括 2 次插入3 次删除
  1. 2 3
      pkg/units/size.go

+ 2 - 3
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++