From c5717510ee45a18af1c2941e828767efb7dcf92f Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 14 Mar 2019 12:36:37 -0400 Subject: [PATCH] feat: always get keys in order Ranging over maps is unordered in golang, so we need to use the correct data structure if we need the output in an ordered way. --- plugins/resource/subcommands.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/resource/subcommands.go b/plugins/resource/subcommands.go index d783adeff..444cc12b0 100644 --- a/plugins/resource/subcommands.go +++ b/plugins/resource/subcommands.go @@ -120,16 +120,16 @@ func reportRequestType(appName string, processType string, requestType string) ( } common.LogInfo2Quiet(message) - resources := map[string]bool{ - "cpu": true, - "memory": true, - "memory-swap": true, - "network": true, - "network-ingress": true, - "network-egress": true, + resources := []string{ + "cpu", + "memory", + "memory-swap", + "network", + "network-ingress", + "network-egress", } - for key := range resources { + for _, key := range resources { property := propertyKey(processType, requestType, key) value := common.PropertyGet("resource", appName, property) common.LogVerbose(fmt.Sprintf("%v: %v", key, value))