Skip to content
This repository has been archived by the owner on Jul 28, 2020. It is now read-only.

Improve code quality in start command #89

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions cmd/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,8 @@ func (s *Start) allocateMemory(metaData workspace.Metadata, stats cfdevos.Stats,
return requestedMem, nil
}

if stats.AvailableMemory < uint64(requestedMem) {
s.UI.Say("WARNING: This machine may not have enough available RAM to run with what is specified.")
return requestedMem, nil
}
s.UI.Say("WARNING: This machine may not have enough available RAM to run with what is specified.")
return requestedMem, nil
}

if requestedMem < baseMem {
Expand All @@ -316,18 +314,16 @@ func (s *Start) allocateMemory(metaData workspace.Metadata, stats cfdevos.Stats,
return requestedMem, nil
}

if stats.AvailableMemory < uint64(requestedMem) {
s.UI.Say("WARNING: This machine may not have enough available RAM to run with what is specified.")
return requestedMem, nil
}
s.UI.Say("WARNING: This machine may not have enough available RAM to run with what is specified.")
return requestedMem, nil
}
} else {
if stats.AvailableMemory >= uint64(baseMem) {
return baseMem, nil
} else {
s.UI.Say(fmt.Sprintf("WARNING: %s Dev requires %v MB of RAM to run. This machine may not have enough free RAM.", strings.ToUpper(metaData.DeploymentName), baseMem))
return baseMem, nil
}

s.UI.Say(fmt.Sprintf("WARNING: %s Dev requires %v MB of RAM to run. This machine may not have enough free RAM.", strings.ToUpper(metaData.DeploymentName), baseMem))
return baseMem, nil
}

return 0, nil
Expand Down