Skip to content

Commit

Permalink
pkg/units: Compacted var declaration and initialization
Browse files Browse the repository at this point in the history
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 <[email protected]> (github: fcarriedo)
  • Loading branch information
fcarriedo committed Jul 24, 2014
1 parent a4d57d8 commit d512294
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/units/size.go
Original file line number Diff line number Diff line change
Expand Up @@ -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++
Expand Down

0 comments on commit d512294

Please sign in to comment.