Skip to content

Commit 87dfd76

Browse files
refactor: replaced fmt.Sprintf with strconv.FormatBool (cosmos#6516)
Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com>
1 parent 460876e commit 87dfd76

5 files changed

Lines changed: 10 additions & 8 deletions

File tree

modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package controller_test
22

33
import (
44
"fmt"
5+
"strconv"
56
"testing"
67

78
testifysuite "github.com/stretchr/testify/suite"
@@ -584,7 +585,7 @@ func (suite *InterchainAccountsTestSuite) TestOnRecvPacket() {
584585
icatypes.EventTypePacket,
585586
sdk.NewAttribute(sdk.AttributeKeyModule, icatypes.ModuleName),
586587
sdk.NewAttribute(icatypes.AttributeKeyControllerChannelID, packet.GetDestChannel()),
587-
sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, fmt.Sprintf("%t", false)),
588+
sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, strconv.FormatBool(false)),
588589
sdk.NewAttribute(icatypes.AttributeKeyAckError, "cannot receive packet on controller chain: invalid message sent to channel end"),
589590
),
590591
}.ToABCIEvents()

modules/apps/27-interchain-accounts/controller/keeper/events.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package keeper
22

33
import (
4-
"fmt"
4+
"strconv"
55

66
sdk "github.com/cosmos/cosmos-sdk/types"
77

@@ -16,7 +16,7 @@ func EmitAcknowledgementEvent(ctx sdk.Context, packet channeltypes.Packet, ack e
1616
attributes := []sdk.Attribute{
1717
sdk.NewAttribute(sdk.AttributeKeyModule, icatypes.ModuleName),
1818
sdk.NewAttribute(icatypes.AttributeKeyControllerChannelID, packet.GetDestChannel()),
19-
sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, fmt.Sprintf("%t", ack.Success())),
19+
sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, strconv.FormatBool(ack.Success())),
2020
}
2121

2222
if err != nil {

modules/apps/27-interchain-accounts/host/ibc_module_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package host_test
22

33
import (
44
"fmt"
5+
"strconv"
56
"testing"
67

78
"github.com/cosmos/gogoproto/proto"
@@ -507,7 +508,7 @@ func (suite *InterchainAccountsTestSuite) TestOnRecvPacket() {
507508
expectedAttributes := []sdk.Attribute{
508509
sdk.NewAttribute(sdk.AttributeKeyModule, icatypes.ModuleName),
509510
sdk.NewAttribute(icatypes.AttributeKeyHostChannelID, packet.GetDestChannel()),
510-
sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, fmt.Sprintf("%t", ack.Success())),
511+
sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, strconv.FormatBool(ack.Success())),
511512
}
512513

513514
if tc.expAckSuccess {

modules/apps/27-interchain-accounts/host/keeper/events.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package keeper
22

33
import (
4-
"fmt"
4+
"strconv"
55

66
sdk "github.com/cosmos/cosmos-sdk/types"
77

@@ -17,7 +17,7 @@ func EmitAcknowledgementEvent(ctx sdk.Context, packet channeltypes.Packet, ack e
1717
attributes := []sdk.Attribute{
1818
sdk.NewAttribute(sdk.AttributeKeyModule, icatypes.ModuleName),
1919
sdk.NewAttribute(icatypes.AttributeKeyHostChannelID, packet.GetDestChannel()),
20-
sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, fmt.Sprintf("%t", ack.Success())),
20+
sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, strconv.FormatBool(ack.Success())),
2121
}
2222

2323
if err != nil {

modules/apps/transfer/internal/events/events.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package events
22

33
import (
44
"encoding/json"
5-
"fmt"
5+
"strconv"
66

77
sdk "github.com/cosmos/cosmos-sdk/types"
88

@@ -38,7 +38,7 @@ func EmitOnRecvPacketEvent(ctx sdk.Context, packetData types.FungibleTokenPacket
3838
sdk.NewAttribute(types.AttributeKeyReceiver, packetData.Receiver),
3939
sdk.NewAttribute(types.AttributeKeyTokens, jsonTokens),
4040
sdk.NewAttribute(types.AttributeKeyMemo, packetData.Memo),
41-
sdk.NewAttribute(types.AttributeKeyAckSuccess, fmt.Sprintf("%t", ack.Success())),
41+
sdk.NewAttribute(types.AttributeKeyAckSuccess, strconv.FormatBool(ack.Success())),
4242
}
4343

4444
if ackErr != nil {

0 commit comments

Comments
 (0)