command/info: Move warning output to the top

This commit is contained in:
Armon Dadgar 2014-04-29 11:09:14 -07:00
parent 46b0fc24d9
commit 8ea7d7fbd9
1 changed files with 15 additions and 8 deletions

View File

@ -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
}