show size in mb

This commit is contained in:
Lynn 2020-02-28 23:51:42 -08:00
parent 45f2a862ff
commit 75089f4a6c
No known key found for this signature in database
GPG Key ID: 9E60BEE0555C367B

View File

@ -8,6 +8,7 @@ import (
"fmt"
"io/ioutil"
"log"
"math"
"os"
"os/exec"
"strings"
@ -199,9 +200,11 @@ func checkBinarySizeActionFunc(c *cli.Context) (err error) {
return err
}
fileSize := fileInfo.Size()
fileSizeMB := float64(fileSize) / float64(1000000)
roundedFileSizeMB := math.Round(fileSizeMB*10) / 10
// show the file size
fmt.Println(fileSize)
fmt.Println(fmt.Sprintf("current binary size is: %.1fMB", roundedFileSizeMB))
return nil
}