From eb6b85510dbaf750fed3862219b43bbb197e36b4 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Tue, 29 Apr 2014 11:09:14 -0700 Subject: [PATCH] command/info: Move warning output to the top --- command/info.go | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/command/info.go b/command/info.go index 0dc9395578..8d9bad776d 100644 --- a/command/info.go +++ b/command/info.go @@ -48,6 +48,21 @@ func (i *InfoCommand) Run(args []string) int { return 1 } + // Check for specific warnings + didWarn := false + runtime, ok := stats["runtime"] + if ok { + if maxprocs := runtime["max_procs"]; maxprocs == "1" { + i.Ui.Output("WARNING: It is highly recommended to set GOMAXPROCS higher than 1") + didWarn = true + } + } + + // Add a blank line if there are any warnings + if didWarn { + i.Ui.Output("") + } + // Get the keys in sorted order keys := make([]string, 0, len(stats)) for key := range stats { @@ -73,14 +88,6 @@ func (i *InfoCommand) Run(args []string) int { i.Ui.Output(fmt.Sprintf("\t%s = %s", subkey, val)) } } - - // Check for specific warnings - runtime, ok := stats["runtime"] - if ok { - if maxprocs := runtime["max_procs"]; maxprocs == "1" { - i.Ui.Output("WARNING: It is highly recommended to set GOMAXPROCS higher than 1") - } - } return 0 }