Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove duplicate imports #2185

Merged
merged 2 commits into from
Sep 6, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import (
"time"

sdk "github.com/cosmos/cosmos-sdk/types"
sdktypes "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"

"github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/types"
controllertypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/types"
icatypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/types"
clienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types"
Expand All @@ -18,7 +16,7 @@ import (

func (suite *KeeperTestSuite) TestRegisterAccount() {
var (
msg *controllertypes.MsgRegisterAccount
msg *types.MsgRegisterAccount
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we have icatypes, clienttypes channeltypes etc. does it make sense to have a package imported as just types? It's not immediately obvious which sort of types it is, I would lean in favour of keeping it called controllertypes and removing the unaliased one WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a lot of other packages we normally import the relative types pkg as is, and then for any types pkgs from other modules we alias them.

I don't really feel strongly about it here. It's also a test file so.. 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For interchain accounts it may help to always alias tho. Considering there is the shared icatypes and then a separate types for both controller and host submodules

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah I see okay, so we generally just do external types with the alias, that seems fine with me 👍

expectedChannelID = "channel-0"
)

Expand Down Expand Up @@ -70,7 +68,7 @@ func (suite *KeeperTestSuite) TestRegisterAccount() {
path := NewICAPath(suite.chainA, suite.chainB)
suite.coordinator.SetupConnections(path)

msg = controllertypes.NewMsgRegisterAccount(ibctesting.FirstConnectionID, ibctesting.TestAccAddress, "")
msg = types.NewMsgRegisterAccount(ibctesting.FirstConnectionID, ibctesting.TestAccAddress, "")

tc.malleate()

Expand All @@ -85,7 +83,7 @@ func (suite *KeeperTestSuite) TestRegisterAccount() {
events := ctx.EventManager().Events()
suite.Require().Len(events, 2)
suite.Require().Equal(events[0].Type, channeltypes.EventTypeChannelOpenInit)
suite.Require().Equal(events[1].Type, sdktypes.EventTypeMessage)
suite.Require().Equal(events[1].Type, sdk.EventTypeMessage)
} else {
suite.Require().Error(err)
suite.Require().Nil(res)
Expand All @@ -96,7 +94,7 @@ func (suite *KeeperTestSuite) TestRegisterAccount() {
func (suite *KeeperTestSuite) TestSubmitTx() {
var (
path *ibctesting.Path
msg *controllertypes.MsgSubmitTx
msg *types.MsgSubmitTx
)

testCases := []struct {
Expand Down