From 351b4f9726c91af09e8b7eea1c9c24c296784d17 Mon Sep 17 00:00:00 2001 From: Jingguo Yao Date: Sun, 9 Nov 2014 10:28:35 +0800 Subject: [PATCH] client: use index expression over rename map Use index expression instead of loop. Change-Id: I26b85e239a227f234fa7432bf7444b6c73e949ba --- pkg/client/config.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/pkg/client/config.go b/pkg/client/config.go index 1660cc602..502214862 100644 --- a/pkg/client/config.go +++ b/pkg/client/config.go @@ -194,16 +194,14 @@ func printConfigChangeHelp(conf jsonconfig.Obj) { oldConfig := false configChangedMsg := fmt.Sprintf("The client configuration file (%s) keys have changed.\n", osutil.UserClientConfigPath()) for _, unknown := range conf.UnknownKeys() { - for k, v := range rename { - if unknown == k { - if v != "" { - configChangedMsg += fmt.Sprintf("%q should be renamed %q.\n", k, v) - } else { - configChangedMsg += fmt.Sprintf("%q should be removed.\n", k) - } - oldConfig = true - break + v, ok := rename[unknown] + if ok { + if v != "" { + configChangedMsg += fmt.Sprintf("%q should be renamed %q.\n", unknown, v) + } else { + configChangedMsg += fmt.Sprintf("%q should be removed.\n", unknown) } + oldConfig = true } } if oldConfig {