Skip to content

Commit

Permalink
Convert the return values to use uint64 instead
Browse files Browse the repository at this point in the history
  • Loading branch information
afbjorklund committed Oct 30, 2020
1 parent e1effd3 commit b17ecbd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pkg/minikube/machine/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ func RemoteHostInfo(r command.Runner) (*HostInfo, error, error, error) {

var info HostInfo
info.CPUs = ncpus
info.Memory = memory
info.DiskSize = disksize
info.Memory = int64(memory)
info.DiskSize = int64(disksize)
return &info, cpuErr, memErr, diskErr
}

Expand Down
12 changes: 6 additions & 6 deletions pkg/util/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func ConvertUnsignedBytesToMB(byteSize uint64) int64 {

// ParseMemFree parses the output of the `free -m` command
// returns: total, available
func ParseMemFree(out string) (int64, int64, error) {
func ParseMemFree(out string) (uint64, uint64, error) {
// total used free shared buff/cache available
//Mem: 1987 706 194 1 1086 1173
//Swap: 0 0 0
Expand All @@ -76,11 +76,11 @@ func ParseMemFree(out string) (int64, int64, error) {
if len(parsedLine) < 7 {
continue
}
t, err := strconv.ParseInt(parsedLine[1], 10, 64)
t, err := strconv.ParseUint(parsedLine[1], 10, 64)
if err != nil {
return 0, 0, err
}
a, err := strconv.ParseInt(parsedLine[6], 10, 64)
a, err := strconv.ParseUint(parsedLine[6], 10, 64)
if err != nil {
return 0, 0, err
}
Expand All @@ -94,7 +94,7 @@ func ParseMemFree(out string) (int64, int64, error) {

// ParseDiskFree parses the output of the `df -m` command
// returns: total, available
func ParseDiskFree(out string) (int64, int64, error) {
func ParseDiskFree(out string) (uint64, uint64, error) {
// Filesystem 1M-blocks Used Available Use% Mounted on
// /dev/sda1 39643 3705 35922 10% /
outlines := strings.Split(out, "\n")
Expand All @@ -104,11 +104,11 @@ func ParseDiskFree(out string) (int64, int64, error) {
if len(parsedLine) < 6 {
continue
}
t, err := strconv.ParseInt(parsedLine[1], 10, 64)
t, err := strconv.ParseUint(parsedLine[1], 10, 64)
if err != nil {
return 0, 0, err
}
a, err := strconv.ParseInt(parsedLine[3], 10, 64)
a, err := strconv.ParseUint(parsedLine[3], 10, 64)
if err != nil {
return 0, 0, err
}
Expand Down

0 comments on commit b17ecbd

Please sign in to comment.