diff --git a/cmd/gaia/cli_test/test_helpers.go b/cmd/gaia/cli_test/test_helpers.go index 802eda04237c..eeda98615518 100644 --- a/cmd/gaia/cli_test/test_helpers.go +++ b/cmd/gaia/cli_test/test_helpers.go @@ -429,7 +429,7 @@ func (f *Fixtures) QueryGovParamTallying() gov.TallyParams { func (f *Fixtures) QueryGovProposals(flags ...string) gov.Proposals { cmd := fmt.Sprintf("gaiacli query gov proposals %v", f.Flags()) stdout, stderr := tests.ExecuteT(f.T, addFlags(cmd, flags), "") - if stderr == "ERROR: No matching proposals found" { + if strings.Contains(stderr, "No matching proposals found") { return gov.Proposals{} } require.Empty(f.T, stderr) diff --git a/x/gov/client/utils/query.go b/x/gov/client/utils/query.go index 400692a7a4b9..7edf68f6796a 100644 --- a/x/gov/client/utils/query.go +++ b/x/gov/client/utils/query.go @@ -28,8 +28,7 @@ func NewProposer(proposalID uint64, proposer string) Proposer { } func (p Proposer) String() string { - return fmt.Sprintf(`ProposalID: %d -Proposer: %s`, p.ProposalID, p.Proposer) + return fmt.Sprintf("Proposal w/ ID %d was proposed by %s", p.ProposalID, p.Proposer) } // QueryDepositsByTxQuery will query for deposits via a direct txs tags query. It @@ -211,7 +210,7 @@ func QueryDepositByTxQuery( // ID. func QueryProposerByTxQuery( cdc *codec.Codec, cliCtx context.CLIContext, proposalID uint64, -) (p Proposer, err error) { +) (Proposer, error) { tags := []string{ fmt.Sprintf("%s='%s'", tags.Action, tags.ActionProposalSubmitted), @@ -222,7 +221,7 @@ func QueryProposerByTxQuery( // support configurable pagination. infos, err := tx.SearchTxs(cliCtx, cdc, tags, defaultPage, defaultLimit) if err != nil { - return + return Proposer{}, err } for _, info := range infos { @@ -234,8 +233,7 @@ func QueryProposerByTxQuery( } } } - err = fmt.Errorf("failed to find the proposer for proposalID %d", proposalID) - return + return Proposer{}, fmt.Errorf("failed to find the proposer for proposalID %d", proposalID) } // QueryProposalByID takes a proposalID and returns a proposal @@ -247,7 +245,6 @@ func QueryProposalByID(proposalID uint64, cliCtx context.CLIContext, cdc *codec. return nil, err } - // Query store res, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/proposal", queryRoute), bz) if err != nil { return nil, err diff --git a/x/gov/depositsvotes.go b/x/gov/depositsvotes.go index 4ab63a966d0c..869ad77dbeee 100644 --- a/x/gov/depositsvotes.go +++ b/x/gov/depositsvotes.go @@ -17,7 +17,7 @@ type Vote struct { } func (v Vote) String() string { - return fmt.Sprintf(`Voter %s voted with option %s on proposal %d`, v.Voter, v.Option, v.ProposalID) + return fmt.Sprintf("Voter %s voted with option %s on proposal %d", v.Voter, v.Option, v.ProposalID) } // Votes is a collection of Vote @@ -49,7 +49,7 @@ type Deposit struct { } func (d Deposit) String() string { - return fmt.Sprintf(`Deposit by %s on Proposal %d is for the amount %s`, + return fmt.Sprintf("Deposit by %s on Proposal %d is for the amount %s", d.Depositor, d.ProposalID, d.Amount) } @@ -57,7 +57,7 @@ func (d Deposit) String() string { type Deposits []Deposit func (d Deposits) String() string { - out := fmt.Sprintf(`Deposits for Proposal %d:`, d[0].ProposalID) + out := fmt.Sprintf("Deposits for Proposal %d:", d[0].ProposalID) for _, dep := range d { out += fmt.Sprintf("\n %s: %s", dep.Depositor, dep.Amount) } diff --git a/x/staking/types/delegation.go b/x/staking/types/delegation.go index 74a92c5da2da..e46f89624633 100644 --- a/x/staking/types/delegation.go +++ b/x/staking/types/delegation.go @@ -198,7 +198,7 @@ func (d UnbondingDelegation) String() string { Validator: %s Entries:`, d.DelegatorAddr, d.ValidatorAddr) for i, entry := range d.Entries { - out += fmt.Sprintf(` UBD %d: + out += fmt.Sprintf(` Unbonding Delegation %d: Creation Height: %v Min time to unbond (unix): %v Expected balance: %s`, i, entry.CreationHeight, @@ -321,7 +321,7 @@ func (d Redelegation) String() string { Destination Validator: %s Entries:`, d.DelegatorAddr, d.ValidatorSrcAddr, d.ValidatorDstAddr) for i, entry := range d.Entries { - out += fmt.Sprintf(` RED %d: + out += fmt.Sprintf(` Redelegation %d: Creation height: %v Min time to unbond (unix): %v Source shares: %s