Skip to content

Commit 04f89a9

Browse files
committed
linter cleanup
1 parent ecd382e commit 04f89a9

File tree

11 files changed

+28
-27
lines changed

11 files changed

+28
-27
lines changed

modules/apps/27-interchain-accounts/controller/types/codec_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package types_test
22

33
import (
4+
"errors"
45
"fmt"
56
"testing"
67

@@ -37,7 +38,7 @@ func TestCodecTypeRegistration(t *testing.T) {
3738
{
3839
"type not registered on codec",
3940
"ibc.invalid.MsgTypeURL",
40-
fmt.Errorf("unable to resolve type URL"),
41+
errors.New("unable to resolve type URL"),
4142
},
4243
}
4344

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package host_test
22

33
import (
44
"errors"
5-
"fmt"
65
"strconv"
76
"testing"
87

@@ -276,7 +275,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenConfirm() {
276275
suite.chainB.GetSimApp().ICAAuthModule.IBCApp.OnChanOpenConfirm = func(
277276
ctx sdk.Context, portID, channelID string,
278277
) error {
279-
return fmt.Errorf("mock ica auth fails")
278+
return errors.New("mock ica auth fails")
280279
}
281280
}, nil,
282281
},
@@ -410,7 +409,7 @@ func (suite *InterchainAccountsTestSuite) TestOnRecvPacket() {
410409
suite.chainB.GetSimApp().ICAAuthModule.IBCApp.OnRecvPacket = func(
411410
ctx sdk.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress,
412411
) exported.Acknowledgement {
413-
return channeltypes.NewErrorAcknowledgement(fmt.Errorf("failed OnRecvPacket mock callback"))
412+
return channeltypes.NewErrorAcknowledgement(errors.New("failed OnRecvPacket mock callback"))
414413
}
415414
}, true,
416415
"failed OnRecvPacket mock callback",

modules/apps/callbacks/ibc_middleware_test.go

+9-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package ibccallbacks_test
22

33
import (
44
"encoding/json"
5+
"errors"
56
"fmt"
7+
"reflect"
68

79
errorsmod "cosmossdk.io/errors"
810
storetypes "cosmossdk.io/store/types"
@@ -43,28 +45,28 @@ func (s *CallbacksTestSuite) TestNewIBCMiddleware() {
4345
func() {
4446
_ = ibccallbacks.NewIBCMiddleware(nil, &channelkeeper.Keeper{}, simapp.ContractKeeper{}, maxCallbackGas)
4547
},
46-
fmt.Errorf("underlying application does not implement %T", (*types.CallbacksCompatibleModule)(nil)),
48+
errors.New("underlying application does not implement " + reflect.TypeOf((*types.CallbacksCompatibleModule)(nil)).String()),
4749
},
4850
{
4951
"panics with nil contract keeper",
5052
func() {
5153
_ = ibccallbacks.NewIBCMiddleware(ibcmock.IBCModule{}, &channelkeeper.Keeper{}, nil, maxCallbackGas)
5254
},
53-
fmt.Errorf("contract keeper cannot be nil"),
55+
errors.New("contract keeper cannot be nil"),
5456
},
5557
{
5658
"panics with nil ics4Wrapper",
5759
func() {
5860
_ = ibccallbacks.NewIBCMiddleware(ibcmock.IBCModule{}, nil, simapp.ContractKeeper{}, maxCallbackGas)
5961
},
60-
fmt.Errorf("ICS4Wrapper cannot be nil"),
62+
errors.New("ICS4Wrapper cannot be nil"),
6163
},
6264
{
6365
"panics with zero maxCallbackGas",
6466
func() {
6567
_ = ibccallbacks.NewIBCMiddleware(ibcmock.IBCModule{}, &channelkeeper.Keeper{}, simapp.ContractKeeper{}, uint64(0))
6668
},
67-
fmt.Errorf("maxCallbackGas cannot be zero"),
69+
errors.New("maxCallbackGas cannot be zero"),
6870
},
6971
}
7072

@@ -239,7 +241,7 @@ func (s *CallbacksTestSuite) TestOnAcknowledgementPacket() {
239241
userGasLimit uint64
240242
)
241243

242-
panicError := fmt.Errorf("panic error")
244+
panicError := errors.New("panic error")
243245

244246
testCases := []struct {
245247
name string
@@ -582,7 +584,7 @@ func (s *CallbacksTestSuite) TestOnRecvPacket() {
582584
)
583585

584586
successAck := channeltypes.NewResultAcknowledgement([]byte{byte(1)})
585-
panicAck := channeltypes.NewErrorAcknowledgement(fmt.Errorf("panic"))
587+
panicAck := channeltypes.NewErrorAcknowledgement(errors.New("panic"))
586588

587589
testCases := []struct {
588590
name string
@@ -855,7 +857,7 @@ func (s *CallbacksTestSuite) TestProcessCallback() {
855857
expGasConsumed uint64
856858
)
857859

858-
callbackError := fmt.Errorf("callbackExecutor error")
860+
callbackError := errors.New("callbackExecutor error")
859861

860862
testCases := []struct {
861863
name string

modules/apps/callbacks/testing/simapp/params/proto.go

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build !test_amino
2-
// +build !test_amino
32

43
package params
54

modules/apps/callbacks/v2/ibc_middleware_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ func (s *CallbacksTestSuite) TestOnAcknowledgementPacket() {
238238
userGasLimit uint64
239239
)
240240

241-
panicError := fmt.Errorf("panic error")
241+
panicError := errors.New("panic error")
242242

243243
testCases := []struct {
244244
name string

modules/apps/transfer/keeper/mbt_relay_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,9 @@ func (suite *KeeperTestSuite) TestModelBasedRelay() {
382382
registerDenomFn()
383383
err = suite.chainB.GetSimApp().TransferKeeper.OnAcknowledgementPacket(
384384
suite.chainB.GetContext(), packet.SourcePort, packet.SourceChannel, tc.packet.Data,
385-
channeltypes.NewErrorAcknowledgement(fmt.Errorf("MBT Error Acknowledgement")))
385+
channeltypes.NewErrorAcknowledgement(errors.New("MBT Error Acknowledgement")))
386386
default:
387-
err = fmt.Errorf("Unknown handler: %s", tc.handler)
387+
err = errors.New("Unknown handler: " + tc.handler)
388388
}
389389
if err != nil {
390390
suite.Require().False(tc.pass, err.Error())

modules/apps/transfer/keeper/relay_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ func (suite *KeeperTestSuite) TestOnRecvPacketSetsTotalEscrowAmountForSourceIBCT
657657
func (suite *KeeperTestSuite) TestOnAcknowledgementPacket() {
658658
var (
659659
successAck = channeltypes.NewResultAcknowledgement([]byte{byte(1)})
660-
failedAck = channeltypes.NewErrorAcknowledgement(fmt.Errorf("failed packet transfer"))
660+
failedAck = channeltypes.NewErrorAcknowledgement(errors.New("failed packet transfer"))
661661
denom types.Denom
662662
amount sdkmath.Int
663663
path *ibctesting.Path
@@ -796,7 +796,7 @@ func (suite *KeeperTestSuite) TestOnAcknowledgementPacketSetsTotalEscrowAmountFo
796796
*/
797797

798798
amount := defaultAmount
799-
ack := channeltypes.NewErrorAcknowledgement(fmt.Errorf("failed packet transfer"))
799+
ack := channeltypes.NewErrorAcknowledgement(errors.New("failed packet transfer"))
800800

801801
// set up
802802
// 2 transfer channels between chain A and chain B

modules/apps/transfer/types/denom_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package types_test
22

33
import (
4-
"fmt"
4+
"errors"
55
"testing"
66

77
"github.com/stretchr/testify/require"
@@ -36,12 +36,12 @@ func (suite *TypesTestSuite) TestDenomsValidate() {
3636
types.NewDenom("uatom", types.NewHop("transfer", "channel-1"), types.NewHop("transfer", "channel-2")),
3737
types.NewDenom("uatom", types.NewHop("transfer", "channel-1"), types.NewHop("transfer", "channel-2")),
3838
},
39-
fmt.Errorf("duplicated denomination with hash"),
39+
errors.New("duplicated denomination with hash"),
4040
},
4141
{
4242
"empty base denom with trace",
4343
types.Denoms{types.NewDenom("", types.NewHop("transfer", "channel-1"))},
44-
fmt.Errorf("base denomination cannot be blank"),
44+
errors.New("base denomination cannot be blank"),
4545
},
4646
}
4747

modules/apps/transfer/types/token_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package types
22

33
import (
4-
"fmt"
4+
"errors"
55
"testing"
66

77
"github.com/stretchr/testify/require"
@@ -126,7 +126,7 @@ func TestValidate(t *testing.T) {
126126
},
127127
Amount: amount,
128128
},
129-
fmt.Errorf("invalid token denom: invalid trace: invalid hop source channel ID : identifier cannot be blank: invalid identifier"),
129+
errors.New("invalid token denom: invalid trace: invalid hop source channel ID : identifier cannot be blank: invalid identifier"),
130130
},
131131
{
132132
"failure: empty identifier in trace",
@@ -137,7 +137,7 @@ func TestValidate(t *testing.T) {
137137
},
138138
Amount: amount,
139139
},
140-
fmt.Errorf("invalid token denom: invalid trace: invalid hop source port ID : identifier cannot be blank: invalid identifier"),
140+
errors.New("invalid token denom: invalid trace: invalid hop source port ID : identifier cannot be blank: invalid identifier"),
141141
},
142142
}
143143

modules/core/02-client/keeper/keeper_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package keeper_test
22

33
import (
4+
"errors"
45
"fmt"
56
"math/rand"
67
"testing"
@@ -623,7 +624,7 @@ func (suite *KeeperTestSuite) TestParams() {
623624
{"success: set default params", types.DefaultParams(), nil},
624625
{"success: empty allowedClients", types.NewParams(), nil},
625626
{"success: subset of allowedClients", types.NewParams(exported.Tendermint, exported.Localhost), nil},
626-
{"failure: contains a single empty string value as allowedClient", types.NewParams(exported.Localhost, ""), fmt.Errorf("client type 1 cannot be blank")},
627+
{"failure: contains a single empty string value as allowedClient", types.NewParams(exported.Localhost, ""), errors.New("client type 1 cannot be blank")},
627628
}
628629

629630
for _, tc := range testCases {

modules/core/02-client/types/msgs_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package types_test
22

33
import (
44
"errors"
5-
"fmt"
65
"testing"
76
"time"
87

@@ -699,7 +698,7 @@ func TestMsgRecoverClientGetSigners(t *testing.T) {
699698
expError error
700699
}{
701700
{"success: valid address", sdk.AccAddress(ibctesting.TestAccAddress), nil},
702-
{"failure: nil address", nil, fmt.Errorf("empty address string is not allowed")},
701+
{"failure: nil address", nil, errors.New("empty address string is not allowed")},
703702
}
704703

705704
for _, tc := range testCases {
@@ -778,7 +777,7 @@ func TestMsgIBCSoftwareUpgrade_GetSigners(t *testing.T) {
778777
{
779778
"failure: nil address",
780779
nil,
781-
fmt.Errorf("empty address string is not allowed"),
780+
errors.New("empty address string is not allowed"),
782781
},
783782
}
784783

0 commit comments

Comments
 (0)