From b5e066339e9790453d3007280e14d460773f35e4 Mon Sep 17 00:00:00 2001 From: NickyMateev Date: Thu, 25 Apr 2019 06:33:08 +0300 Subject: [PATCH] Improve code quality --- cmd/start/start.go | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/cmd/start/start.go b/cmd/start/start.go index 79f16bd..4179b7f 100644 --- a/cmd/start/start.go +++ b/cmd/start/start.go @@ -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 { @@ -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