Skip to content

Commit

Permalink
gofumpt v3.2.x (cosmos#1735)
Browse files Browse the repository at this point in the history
* gofumpt v3.2.x

* update Makefile, run make format
  • Loading branch information
faddat authored and dudong2 committed Jan 19, 2023
1 parent a7510b7 commit 40ea225
Show file tree
Hide file tree
Showing 96 changed files with 218 additions and 347 deletions.
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,8 @@ lint-fix:
golangci-lint run --fix --out-format=tab --issues-exit-code=0
.PHONY: lint lint-fix

format:
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -path "./tests/mocks/*" -not -name '*.pb.go' | xargs gofmt -w -s
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -path "./tests/mocks/*" -not -name '*.pb.go' | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -path "./tests/mocks/*" -not -name '*.pb.go' | xargs goimports -w -local github.com/line/lbm-sdk
format:
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -path "./tests/mocks/*" -not -name '*.pb.go' -not -name '*.pb.gw.go' | xargs gofumpt -w
.PHONY: format

###############################################################################
Expand Down
26 changes: 5 additions & 21 deletions modules/apps/27-interchain-accounts/controller/ibc_module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ func SetupICAPath(path *ibctesting.Path, owner string) error {
}

func (suite *InterchainAccountsTestSuite) TestOnChanOpenInit() {
var (
channel *channeltypes.Channel
)
var channel *channeltypes.Channel

testCases := []struct {
name string
Expand Down Expand Up @@ -260,9 +258,7 @@ func (suite *InterchainAccountsTestSuite) TestChanOpenTry() {
}

func (suite *InterchainAccountsTestSuite) TestOnChanOpenAck() {
var (
path *ibctesting.Path
)
var path *ibctesting.Path

testCases := []struct {
name string
Expand Down Expand Up @@ -323,10 +319,8 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenAck() {
} else {
suite.Require().Error(err)
}

})
}

}

// Test initiating a ChanOpenConfirm using the controller chain instead of the host chain
Expand Down Expand Up @@ -377,7 +371,6 @@ func (suite *InterchainAccountsTestSuite) TestChanOpenConfirm() {
suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID,
)
suite.Require().Error(err)

}

// OnChanCloseInit on controller (chainA)
Expand All @@ -402,16 +395,13 @@ func (suite *InterchainAccountsTestSuite) TestOnChanCloseInit() {
}

func (suite *InterchainAccountsTestSuite) TestOnChanCloseConfirm() {
var (
path *ibctesting.Path
)
var path *ibctesting.Path

testCases := []struct {
name string
malleate func()
expPass bool
}{

{
"success", func() {}, true,
},
Expand Down Expand Up @@ -442,13 +432,11 @@ func (suite *InterchainAccountsTestSuite) TestOnChanCloseConfirm() {
} else {
suite.Require().Error(err)
}

})
}
}

func (suite *InterchainAccountsTestSuite) TestOnRecvPacket() {

testCases := []struct {
name string
malleate func()
Expand Down Expand Up @@ -497,9 +485,7 @@ func (suite *InterchainAccountsTestSuite) TestOnRecvPacket() {
}

func (suite *InterchainAccountsTestSuite) TestOnAcknowledgementPacket() {
var (
path *ibctesting.Path
)
var path *ibctesting.Path

testCases := []struct {
msg string
Expand Down Expand Up @@ -568,9 +554,7 @@ func (suite *InterchainAccountsTestSuite) TestOnAcknowledgementPacket() {
}

func (suite *InterchainAccountsTestSuite) TestOnTimeoutPacket() {
var (
path *ibctesting.Path
)
var path *ibctesting.Path

testCases := []struct {
msg string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

// RegisterInterchainAccount is the entry point to registering an interchain account.
// It generates a new port identifier using the owner address. It will bind to the
// It generates a new port identifier using the owner address. It will bind to the
// port identifier and call 04-channel 'ChanOpenInit'. An error is returned if the port
// identifier is already in use. Gaining access to interchain accounts whose channels
// have closed cannot be done with this function. A regular MsgChanOpenInit must be used.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func (suite *KeeperTestSuite) TestInitGenesis() {
expParams := types.NewParams(false)
params := suite.chainA.GetSimApp().ICAControllerKeeper.GetParams(suite.chainA.GetContext())
suite.Require().Equal(expParams, params)

}

func (suite *KeeperTestSuite) TestExportGenesis() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,5 @@ func (k Keeper) OnChanCloseConfirm(
portID,
channelID string,
) error {

return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ func (suite *KeeperTestSuite) TestOnChanOpenInit() {
malleate func()
expPass bool
}{

{
"success",
func() {
Expand Down Expand Up @@ -242,7 +241,6 @@ func (suite *KeeperTestSuite) TestOnChanOpenInit() {
} else {
suite.Require().Error(err)
}

})
}
}
Expand Down Expand Up @@ -402,16 +400,13 @@ func (suite *KeeperTestSuite) TestOnChanOpenAck() {
}

func (suite *KeeperTestSuite) TestOnChanCloseConfirm() {
var (
path *ibctesting.Path
)
var path *ibctesting.Path

testCases := []struct {
name string
malleate func()
expPass bool
}{

{
"success", func() {}, true,
},
Expand Down Expand Up @@ -441,7 +436,6 @@ func (suite *KeeperTestSuite) TestOnChanCloseConfirm() {
} else {
suite.Require().Error(err)
}

})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func NewKeeper(
ics4Wrapper icatypes.ICS4Wrapper, channelKeeper icatypes.ChannelKeeper, portKeeper icatypes.PortKeeper,
scopedKeeper capabilitykeeper.ScopedKeeper, msgRouter *baseapp.MsgServiceRouter,
) Keeper {

// set KeyTable if it has not already been set
if !paramSpace.HasKeyTable() {
paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,7 @@ func (suite *KeeperTestSuite) TestSendTx() {
}

func (suite *KeeperTestSuite) TestOnTimeoutPacket() {
var (
path *ibctesting.Path
)
var path *ibctesting.Path

testCases := []struct {
msg string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ const (
DefaultControllerEnabled = true
)

var (
// KeyControllerEnabled is the store key for ControllerEnabled Params
KeyControllerEnabled = []byte("ControllerEnabled")
)
// KeyControllerEnabled is the store key for ControllerEnabled Params
var KeyControllerEnabled = []byte("ControllerEnabled")

// ParamKeyTable type declaration for parameters
func ParamKeyTable() paramtypes.KeyTable {
Expand Down
22 changes: 2 additions & 20 deletions modules/apps/27-interchain-accounts/host/ibc_module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenTry() {
malleate func()
expPass bool
}{

{
"success", func() {}, true,
},
Expand All @@ -166,7 +165,6 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenTry() {
) (string, error) {
return "", fmt.Errorf("mock ica auth fails")
}

}, true,
},
{
Expand Down Expand Up @@ -223,10 +221,8 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenTry() {
suite.Require().Error(err)
suite.Require().Equal("", version)
}

})
}

}

// Test initiating a ChanOpenAck using the host chain instead of the controller chain
Expand Down Expand Up @@ -270,7 +266,6 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenConfirm() {
malleate func()
expPass bool
}{

{
"success", func() {}, true,
},
Expand All @@ -287,7 +282,6 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenConfirm() {
) error {
return fmt.Errorf("mock ica auth fails")
}

}, true,
},
}
Expand Down Expand Up @@ -324,10 +318,8 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenConfirm() {
} else {
suite.Require().Error(err)
}

})
}

}

// OnChanCloseInit on host (chainB)
Expand All @@ -352,16 +344,13 @@ func (suite *InterchainAccountsTestSuite) TestOnChanCloseInit() {
}

func (suite *InterchainAccountsTestSuite) TestOnChanCloseConfirm() {
var (
path *ibctesting.Path
)
var path *ibctesting.Path

testCases := []struct {
name string
malleate func()
expPass bool
}{

{
"success", func() {}, true,
},
Expand Down Expand Up @@ -392,15 +381,12 @@ func (suite *InterchainAccountsTestSuite) TestOnChanCloseConfirm() {
} else {
suite.Require().Error(err)
}

})
}
}

func (suite *InterchainAccountsTestSuite) TestOnRecvPacket() {
var (
packetData []byte
)
var packetData []byte
testCases := []struct {
name string
malleate func()
Expand Down Expand Up @@ -504,14 +490,11 @@ func (suite *InterchainAccountsTestSuite) TestOnRecvPacket() {
} else {
suite.Require().False(ack.Success())
}

})
}

}

func (suite *InterchainAccountsTestSuite) TestOnAcknowledgementPacket() {

testCases := []struct {
name string
malleate func()
Expand Down Expand Up @@ -565,7 +548,6 @@ func (suite *InterchainAccountsTestSuite) TestOnAcknowledgementPacket() {
}

func (suite *InterchainAccountsTestSuite) TestOnTimeoutPacket() {

testCases := []struct {
name string
malleate func()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func (suite *KeeperTestSuite) TestRegisterInterchainAccount() {
path := NewICAPath(suite.chainA, suite.chainB)
suite.coordinator.SetupConnections(path)

//RegisterInterchainAccount
// RegisterInterchainAccount
err := SetupICAPath(path, TestOwnerAddress)
suite.Require().NoError(err)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,5 @@ func (k Keeper) OnChanCloseConfirm(
portID,
channelID string,
) error {

return nil
}
13 changes: 2 additions & 11 deletions modules/apps/27-interchain-accounts/host/keeper/handshake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ func (suite *KeeperTestSuite) TestOnChanOpenTry() {
malleate func()
expPass bool
}{

{
"success",
func() {
Expand Down Expand Up @@ -228,16 +227,13 @@ func (suite *KeeperTestSuite) TestOnChanOpenTry() {
}

func (suite *KeeperTestSuite) TestOnChanOpenConfirm() {
var (
path *ibctesting.Path
)
var path *ibctesting.Path

testCases := []struct {
name string
malleate func()
expPass bool
}{

{
"success", func() {}, true,
},
Expand Down Expand Up @@ -279,22 +275,18 @@ func (suite *KeeperTestSuite) TestOnChanOpenConfirm() {
} else {
suite.Require().Error(err)
}

})
}
}

func (suite *KeeperTestSuite) TestOnChanCloseConfirm() {
var (
path *ibctesting.Path
)
var path *ibctesting.Path

testCases := []struct {
name string
malleate func()
expPass bool
}{

{
"success", func() {}, true,
},
Expand All @@ -320,7 +312,6 @@ func (suite *KeeperTestSuite) TestOnChanCloseConfirm() {
} else {
suite.Require().Error(err)
}

})
}
}
1 change: 0 additions & 1 deletion modules/apps/27-interchain-accounts/host/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func NewKeeper(
channelKeeper icatypes.ChannelKeeper, portKeeper icatypes.PortKeeper,
accountKeeper icatypes.AccountKeeper, scopedKeeper capabilitykeeper.ScopedKeeper, msgRouter *baseapp.MsgServiceRouter,
) Keeper {

// ensure ibc interchain accounts module account is set
if addr := accountKeeper.GetModuleAddress(icatypes.ModuleName); addr == nil {
panic("the Interchain Accounts module account has not been set")
Expand Down
Loading

0 comments on commit 40ea225

Please sign in to comment.