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)
| ... | ... |
@@ -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++ |