Cleanup loop per Alexis

This commit is contained in:
Ethan Frey 2017-10-19 17:44:22 +02:00
parent ae6c9ef9b1
commit 822b6a3fef
1 changed files with 4 additions and 8 deletions

View File

@ -54,22 +54,18 @@ func GetOptions(path string) ([]Option, error) {
opts := genDoc.AppOptions
cnt := 1 + len(opts.Accounts) + len(opts.pluginOptions)
res := make([]Option, cnt)
res[0] = Option{sdk.ModuleNameBase, sdk.ChainKey, genDoc.ChainID}
i := 1
res := make([]Option, 0, cnt)
res = append(res, Option{sdk.ModuleNameBase, sdk.ChainKey, genDoc.ChainID})
// set accounts
for _, acct := range opts.Accounts {
res[i] = Option{"coin", "account", string(acct)}
i++
res = append(res, Option{"coin", "account", string(acct)})
}
// set plugin options
for _, kv := range opts.pluginOptions {
module, key := splitKey(kv.Key)
res[i] = Option{module, key, kv.Value}
i++
res = append(res, Option{module, key, kv.Value})
}
return res, nil