diff --git a/x/gov/client/utils/utils.go b/x/gov/client/utils/utils.go index 7ac1c77f2156..a3c3723b995a 100644 --- a/x/gov/client/utils/utils.go +++ b/x/gov/client/utils/utils.go @@ -49,8 +49,9 @@ func NormalizeProposalType(proposalType string) v1.ProposalType { // NormalizeWeightedVoteOptions - normalize vote options param string func NormalizeWeightedVoteOptions(options string) string { - newOptions := []string{} - for _, option := range strings.Split(options, ",") { + tmpOptions := strings.Split(options, ",") + newOptions := make([]string, 0, len(tmpOptions)) + for _, option := range tmpOptions { fields := strings.Split(option, "=") fields[0] = NormalizeVoteOption(fields[0]) if len(fields) < 2 { diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index d2c13cea6ba8..c93ea91e1a54 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -325,7 +325,7 @@ func (k Keeper) validateInitialDeposit(params v1.Params, initialDeposit sdk.Coin // validateDepositDenom validates if the deposit denom is accepted by the governance module. func (k Keeper) validateDepositDenom(params v1.Params, depositAmount sdk.Coins) error { - denoms := []string{} + denoms := make([]string, 0, len(params.MinDeposit)) acceptedDenoms := make(map[string]bool, len(params.MinDeposit)) for _, coin := range params.MinDeposit { acceptedDenoms[coin.Denom] = true diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index ff7a8ab1ebde..91f97b0a7b3a 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -39,7 +39,7 @@ func (k Keeper) SubmitProposal(ctx context.Context, messages []sdk.Msg, metadata } } - msgs := []string{} // will hold a string slice of all Msg type URLs. + msgs := make([]string, 0, len(messages)) // will hold a string slice of all Msg type URLs. // Loop through all messages and confirm that each has a handler and the gov module account as the only signer for _, msg := range messages {