client: use index expression over rename map

Use index expression instead of loop.

Change-Id: I26b85e239a227f234fa7432bf7444b6c73e949ba
This commit is contained in:
Jingguo Yao 2014-11-09 10:28:35 +08:00
parent 3374899d40
commit 351b4f9726
1 changed files with 7 additions and 9 deletions

View File

@ -194,16 +194,14 @@ func printConfigChangeHelp(conf jsonconfig.Obj) {
oldConfig := false oldConfig := false
configChangedMsg := fmt.Sprintf("The client configuration file (%s) keys have changed.\n", osutil.UserClientConfigPath()) configChangedMsg := fmt.Sprintf("The client configuration file (%s) keys have changed.\n", osutil.UserClientConfigPath())
for _, unknown := range conf.UnknownKeys() { for _, unknown := range conf.UnknownKeys() {
for k, v := range rename { v, ok := rename[unknown]
if unknown == k { if ok {
if v != "" { if v != "" {
configChangedMsg += fmt.Sprintf("%q should be renamed %q.\n", k, v) configChangedMsg += fmt.Sprintf("%q should be renamed %q.\n", unknown, v)
} else { } else {
configChangedMsg += fmt.Sprintf("%q should be removed.\n", k) configChangedMsg += fmt.Sprintf("%q should be removed.\n", unknown)
}
oldConfig = true
break
} }
oldConfig = true
} }
} }
if oldConfig { if oldConfig {