diff --git a/.golangci.yml b/.golangci.yml index b7a6b8bbcdc..19c59963c96 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -13,7 +13,6 @@ linters: - errcheck - goconst - gocritic - - gofmt - gofumpt - goimports - gosec diff --git a/Makefile b/Makefile index dce31b840b0..889afde064f 100644 --- a/Makefile +++ b/Makefile @@ -338,8 +338,8 @@ lint-fix: .PHONY: lint lint-fix format: goimports - 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' -not -name '*.pb.gw.go' | xargs gofumpt -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' -not -name '*.pb.gw.go' | xargs misspell -w .PHONY: format goimports: diff --git a/e2e/testsuite/testsuite.go b/e2e/testsuite/testsuite.go index 952ef853fc6..8bd7e08dd7d 100644 --- a/e2e/testsuite/testsuite.go +++ b/e2e/testsuite/testsuite.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "io/ioutil" - "strings" "time" diff --git a/modules/apps/transfer/types/msgs.go b/modules/apps/transfer/types/msgs.go index 50177d4b378..a582eda1981 100644 --- a/modules/apps/transfer/types/msgs.go +++ b/modules/apps/transfer/types/msgs.go @@ -16,6 +16,7 @@ const ( ) // NewMsgTransfer creates a new MsgTransfer instance +// //nolint:interfacer func NewMsgTransfer( sourcePort, sourceChannel string, diff --git a/modules/apps/transfer/types/trace.go b/modules/apps/transfer/types/trace.go index ce0312401fc..214e8ff9c53 100644 --- a/modules/apps/transfer/types/trace.go +++ b/modules/apps/transfer/types/trace.go @@ -178,8 +178,8 @@ func (t Traces) Sort() Traces { // ValidatePrefixedDenom checks that the denomination for an IBC fungible token packet denom is correctly prefixed. // The function will return no error if the given string follows one of the two formats: // -// - Prefixed denomination: '{portIDN}/{channelIDN}/.../{portID0}/{channelID0}/baseDenom' -// - Unprefixed denomination: 'baseDenom' +// - Prefixed denomination: '{portIDN}/{channelIDN}/.../{portID0}/{channelID0}/baseDenom' +// - Unprefixed denomination: 'baseDenom' // // 'baseDenom' may or may not contain '/'s func ValidatePrefixedDenom(denom string) error { @@ -205,8 +205,8 @@ func ValidatePrefixedDenom(denom string) error { // ValidateIBCDenom validates that the given denomination is either: // -// - A valid base denomination (eg: 'uatom' or 'gamm/pool/1' as in https://github.com/cosmos/ibc-go/issues/894) -// - A valid fungible token representation (i.e 'ibc/{hash}') per ADR 001 https://github.com/cosmos/ibc-go/blob/main/docs/architecture/adr-001-coin-source-tracing.md +// - A valid base denomination (eg: 'uatom' or 'gamm/pool/1' as in https://github.com/cosmos/ibc-go/issues/894) +// - A valid fungible token representation (i.e 'ibc/{hash}') per ADR 001 https://github.com/cosmos/ibc-go/blob/main/docs/architecture/adr-001-coin-source-tracing.md func ValidateIBCDenom(denom string) error { if err := sdk.ValidateDenom(denom); err != nil { return err diff --git a/modules/core/02-client/types/msgs.go b/modules/core/02-client/types/msgs.go index 92b8f7c2282..da1ef19275c 100644 --- a/modules/core/02-client/types/msgs.go +++ b/modules/core/02-client/types/msgs.go @@ -30,6 +30,7 @@ var ( ) // NewMsgCreateClient creates a new MsgCreateClient instance +// //nolint:interfacer func NewMsgCreateClient( clientState exported.ClientState, consensusState exported.ConsensusState, signer string, @@ -102,6 +103,7 @@ func (msg MsgCreateClient) UnpackInterfaces(unpacker codectypes.AnyUnpacker) err } // NewMsgUpdateClient creates a new MsgUpdateClient instance +// //nolint:interfacer func NewMsgUpdateClient(id string, header exported.Header, signer string) (*MsgUpdateClient, error) { anyHeader, err := PackHeader(header) @@ -151,7 +153,8 @@ func (msg MsgUpdateClient) UnpackInterfaces(unpacker codectypes.AnyUnpacker) err } // NewMsgUpgradeClient creates a new MsgUpgradeClient instance -// nolint: interfacer +// +//nolint:interfacer func NewMsgUpgradeClient(clientID string, clientState exported.ClientState, consState exported.ConsensusState, proofUpgradeClient, proofUpgradeConsState []byte, signer string, ) (*MsgUpgradeClient, error) { @@ -228,6 +231,7 @@ func (msg MsgUpgradeClient) UnpackInterfaces(unpacker codectypes.AnyUnpacker) er } // NewMsgSubmitMisbehaviour creates a new MsgSubmitMisbehaviour instance. +// //nolint:interfacer func NewMsgSubmitMisbehaviour(clientID string, misbehaviour exported.Misbehaviour, signer string) (*MsgSubmitMisbehaviour, error) { anyMisbehaviour, err := PackMisbehaviour(misbehaviour) diff --git a/modules/core/03-connection/keeper/handshake.go b/modules/core/03-connection/keeper/handshake.go index ce0db6a469b..26e4fafa3b2 100644 --- a/modules/core/03-connection/keeper/handshake.go +++ b/modules/core/03-connection/keeper/handshake.go @@ -56,8 +56,8 @@ func (k Keeper) ConnOpenInit( // code is executed on chain B). // // NOTE: -// - Here chain A acts as the counterparty -// - Identifiers are checked on msg validation +// - Here chain A acts as the counterparty +// - Identifiers are checked on msg validation func (k Keeper) ConnOpenTry( ctx sdk.Context, counterparty types.Counterparty, // counterpartyConnectionIdentifier, counterpartyPrefix and counterpartyClientIdentifier diff --git a/modules/core/03-connection/types/msgs.go b/modules/core/03-connection/types/msgs.go index efc9681f81c..d9a5377292e 100644 --- a/modules/core/03-connection/types/msgs.go +++ b/modules/core/03-connection/types/msgs.go @@ -23,6 +23,7 @@ var ( // NewMsgConnectionOpenInit creates a new MsgConnectionOpenInit instance. It sets the // counterparty connection identifier to be empty. +// //nolint:interfacer func NewMsgConnectionOpenInit( clientID, counterpartyClientID string, @@ -72,6 +73,7 @@ func (msg MsgConnectionOpenInit) GetSigners() []sdk.AccAddress { } // NewMsgConnectionOpenTry creates a new MsgConnectionOpenTry instance +// //nolint:interfacer func NewMsgConnectionOpenTry( clientID, counterpartyConnectionID, counterpartyClientID string, @@ -165,6 +167,7 @@ func (msg MsgConnectionOpenTry) GetSigners() []sdk.AccAddress { } // NewMsgConnectionOpenAck creates a new MsgConnectionOpenAck instance +// //nolint:interfacer func NewMsgConnectionOpenAck( connectionID, counterpartyConnectionID string, counterpartyClient exported.ClientState, @@ -246,6 +249,7 @@ func (msg MsgConnectionOpenAck) GetSigners() []sdk.AccAddress { } // NewMsgConnectionOpenConfirm creates a new MsgConnectionOpenConfirm instance +// //nolint:interfacer func NewMsgConnectionOpenConfirm( connectionID string, proofAck []byte, proofHeight clienttypes.Height, diff --git a/modules/core/04-channel/keeper/handshake.go b/modules/core/04-channel/keeper/handshake.go index 6e4a4def90b..2ece6d96e4b 100644 --- a/modules/core/04-channel/keeper/handshake.go +++ b/modules/core/04-channel/keeper/handshake.go @@ -291,7 +291,7 @@ func (k Keeper) WriteOpenAckChannel( } // ChanOpenConfirm is called by the counterparty module to close their end of the -// channel, since the other end has been closed. +// channel, since the other end has been closed. func (k Keeper) ChanOpenConfirm( ctx sdk.Context, portID, diff --git a/modules/core/04-channel/types/msgs.go b/modules/core/04-channel/types/msgs.go index f9f33556867..ca7893d48bc 100644 --- a/modules/core/04-channel/types/msgs.go +++ b/modules/core/04-channel/types/msgs.go @@ -15,7 +15,8 @@ var _ sdk.Msg = &MsgChannelOpenInit{} // NewMsgChannelOpenInit creates a new MsgChannelOpenInit. It sets the counterparty channel // identifier to be empty. -// nolint:interfacer +// +//nolint:interfacer func NewMsgChannelOpenInit( portID, version string, channelOrder Order, connectionHops []string, counterpartyPortID string, signer string, @@ -64,7 +65,8 @@ var _ sdk.Msg = &MsgChannelOpenTry{} // NewMsgChannelOpenTry creates a new MsgChannelOpenTry instance // The version string is deprecated and will be ignored by core IBC. // It is left as an argument for go API backwards compatibility. -// nolint:interfacer +// +//nolint:interfacer func NewMsgChannelOpenTry( portID, version string, channelOrder Order, connectionHops []string, counterpartyPortID, counterpartyChannelID, counterpartyVersion string, @@ -126,7 +128,8 @@ func (msg MsgChannelOpenTry) GetSigners() []sdk.AccAddress { var _ sdk.Msg = &MsgChannelOpenAck{} // NewMsgChannelOpenAck creates a new MsgChannelOpenAck instance -// nolint:interfacer +// +//nolint:interfacer func NewMsgChannelOpenAck( portID, channelID, counterpartyChannelID string, cpv string, proofTry []byte, proofHeight clienttypes.Height, signer string, @@ -178,7 +181,8 @@ func (msg MsgChannelOpenAck) GetSigners() []sdk.AccAddress { var _ sdk.Msg = &MsgChannelOpenConfirm{} // NewMsgChannelOpenConfirm creates a new MsgChannelOpenConfirm instance -// nolint:interfacer +// +//nolint:interfacer func NewMsgChannelOpenConfirm( portID, channelID string, proofAck []byte, proofHeight clienttypes.Height, signer string, @@ -225,7 +229,8 @@ func (msg MsgChannelOpenConfirm) GetSigners() []sdk.AccAddress { var _ sdk.Msg = &MsgChannelCloseInit{} // NewMsgChannelCloseInit creates a new MsgChannelCloseInit instance -// nolint:interfacer +// +//nolint:interfacer func NewMsgChannelCloseInit( portID string, channelID string, signer string, ) *MsgChannelCloseInit { @@ -263,7 +268,8 @@ func (msg MsgChannelCloseInit) GetSigners() []sdk.AccAddress { var _ sdk.Msg = &MsgChannelCloseConfirm{} // NewMsgChannelCloseConfirm creates a new MsgChannelCloseConfirm instance -// nolint:interfacer +// +//nolint:interfacer func NewMsgChannelCloseConfirm( portID, channelID string, proofInit []byte, proofHeight clienttypes.Height, signer string, @@ -310,7 +316,8 @@ func (msg MsgChannelCloseConfirm) GetSigners() []sdk.AccAddress { var _ sdk.Msg = &MsgRecvPacket{} // NewMsgRecvPacket constructs new MsgRecvPacket -// nolint:interfacer +// +//nolint:interfacer func NewMsgRecvPacket( packet Packet, proofCommitment []byte, proofHeight clienttypes.Height, signer string, @@ -357,7 +364,8 @@ func (msg MsgRecvPacket) GetSigners() []sdk.AccAddress { var _ sdk.Msg = &MsgTimeout{} // NewMsgTimeout constructs new MsgTimeout -// nolint:interfacer +// +//nolint:interfacer func NewMsgTimeout( packet Packet, nextSequenceRecv uint64, proofUnreceived []byte, proofHeight clienttypes.Height, signer string, @@ -399,7 +407,8 @@ func (msg MsgTimeout) GetSigners() []sdk.AccAddress { } // NewMsgTimeoutOnClose constructs new MsgTimeoutOnClose -// nolint:interfacer +// +//nolint:interfacer func NewMsgTimeoutOnClose( packet Packet, nextSequenceRecv uint64, proofUnreceived, proofClose []byte, @@ -448,7 +457,8 @@ func (msg MsgTimeoutOnClose) GetSigners() []sdk.AccAddress { var _ sdk.Msg = &MsgAcknowledgement{} // NewMsgAcknowledgement constructs a new MsgAcknowledgement -// nolint:interfacer +// +//nolint:interfacer func NewMsgAcknowledgement( packet Packet, ack, proofAcked []byte, diff --git a/modules/core/24-host/doc.go b/modules/core/24-host/doc.go index 0d73c4e7efe..4e5eaa556be 100644 --- a/modules/core/24-host/doc.go +++ b/modules/core/24-host/doc.go @@ -4,6 +4,5 @@ The storage path supported are defined in [ICS24](https://github.com/cosmos/ibc/blob/master/spec/core/ics-024-host-requirements#path-space). Hostname validation is implemented as defined in [ICS 24](https://github.com/cosmos/ibc/tree/master/spec/core/ics-024-host-requirements). - */ package host diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index c223fdc75d3..420e8c429e6 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -472,7 +472,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutPacket() { // and unordered channels. It verifies that the deletion of a packet // commitment occurs. It tests high level properties like ordering and basic // sanity checks. More rigorous testing of 'TimeoutOnClose' and -//'TimeoutExecuted' can be found in the 04-channel/keeper/timeout_test.go. +// 'TimeoutExecuted' can be found in the 04-channel/keeper/timeout_test.go. func (suite *KeeperTestSuite) TestHandleTimeoutOnClosePacket() { var ( packet channeltypes.Packet diff --git a/modules/light-clients/06-solomachine/types/proof.go b/modules/light-clients/06-solomachine/types/proof.go index c233b1e3908..35ce4d9cd54 100644 --- a/modules/light-clients/06-solomachine/types/proof.go +++ b/modules/light-clients/06-solomachine/types/proof.go @@ -123,7 +123,7 @@ func ClientStateSignBytes( // SignBytes. func ClientStateDataBytes( cdc codec.BinaryCodec, - path commitmenttypes.MerklePath, // nolint: interfacer + path commitmenttypes.MerklePath, //nolint:interfacer clientState exported.ClientState, ) ([]byte, error) { any, err := clienttypes.PackClientState(clientState) @@ -173,7 +173,7 @@ func ConsensusStateSignBytes( // SignBytes. func ConsensusStateDataBytes( cdc codec.BinaryCodec, - path commitmenttypes.MerklePath, // nolint: interfacer + path commitmenttypes.MerklePath, //nolint:interfacer consensusState exported.ConsensusState, ) ([]byte, error) { any, err := clienttypes.PackConsensusState(consensusState) @@ -223,7 +223,7 @@ func ConnectionStateSignBytes( // SignBytes. func ConnectionStateDataBytes( cdc codec.BinaryCodec, - path commitmenttypes.MerklePath, // nolint: interfacer + path commitmenttypes.MerklePath, //nolint:interfacer connectionEnd exported.ConnectionI, ) ([]byte, error) { connection, ok := connectionEnd.(connectiontypes.ConnectionEnd) @@ -276,7 +276,7 @@ func ChannelStateSignBytes( // SignBytes. func ChannelStateDataBytes( cdc codec.BinaryCodec, - path commitmenttypes.MerklePath, // nolint: interfacer + path commitmenttypes.MerklePath, //nolint:interfacer channelEnd exported.ChannelI, ) ([]byte, error) { channel, ok := channelEnd.(channeltypes.Channel) @@ -328,7 +328,7 @@ func PacketCommitmentSignBytes( // SignBytes. func PacketCommitmentDataBytes( cdc codec.BinaryCodec, - path commitmenttypes.MerklePath, // nolint: interfacer + path commitmenttypes.MerklePath, //nolint:interfacer commitmentBytes []byte, ) ([]byte, error) { data := &PacketCommitmentData{ @@ -373,7 +373,7 @@ func PacketAcknowledgementSignBytes( // SignBytes. func PacketAcknowledgementDataBytes( cdc codec.BinaryCodec, - path commitmenttypes.MerklePath, // nolint: interfacer + path commitmenttypes.MerklePath, //nolint:interfacer acknowledgement []byte, ) ([]byte, error) { data := &PacketAcknowledgementData{ @@ -417,7 +417,7 @@ func PacketReceiptAbsenceSignBytes( // used in constructing SignBytes. func PacketReceiptAbsenceDataBytes( cdc codec.BinaryCodec, - path commitmenttypes.MerklePath, // nolint: interfacer + path commitmenttypes.MerklePath, //nolint:interfacer ) ([]byte, error) { data := &PacketReceiptAbsenceData{ Path: []byte(path.String()), @@ -460,7 +460,7 @@ func NextSequenceRecvSignBytes( // SignBytes. func NextSequenceRecvDataBytes( cdc codec.BinaryCodec, - path commitmenttypes.MerklePath, // nolint: interfacer + path commitmenttypes.MerklePath, //nolint:interfacer nextSequenceRecv uint64, ) ([]byte, error) { data := &NextSequenceRecvData{ diff --git a/modules/light-clients/07-tendermint/types/proposal_handle.go b/modules/light-clients/07-tendermint/types/proposal_handle.go index 1b777e942f5..9a75c5f9b9f 100644 --- a/modules/light-clients/07-tendermint/types/proposal_handle.go +++ b/modules/light-clients/07-tendermint/types/proposal_handle.go @@ -19,8 +19,8 @@ import ( // Please see ADR 026 for more information. // // The following must always be true: -// - The substitute client is the same type as the subject client -// - The subject and substitute client states match in all parameters (expect frozen height, latest height, and chain-id) +// - The substitute client is the same type as the subject client +// - The subject and substitute client states match in all parameters (expect frozen height, latest height, and chain-id) // // In case 1) before updating the client, the client will be unfrozen by resetting // the FrozenHeight to the zero Height. diff --git a/modules/light-clients/07-tendermint/types/upgrade.go b/modules/light-clients/07-tendermint/types/upgrade.go index 4621ff7312f..07ce9823d2e 100644 --- a/modules/light-clients/07-tendermint/types/upgrade.go +++ b/modules/light-clients/07-tendermint/types/upgrade.go @@ -20,10 +20,10 @@ import ( // - the upgradedClient is not a Tendermint ClientState // - the lastest height of the client state does not have the same revision number or has a greater // height than the committed client. -// - the height of upgraded client is not greater than that of current client -// - the latest height of the new client does not match or is greater than the height in committed client -// - any Tendermint chain specified parameter in upgraded client such as ChainID, UnbondingPeriod, -// and ProofSpecs do not match parameters set by committed client +// - the height of upgraded client is not greater than that of current client +// - the latest height of the new client does not match or is greater than the height in committed client +// - any Tendermint chain specified parameter in upgraded client such as ChainID, UnbondingPeriod, +// and ProofSpecs do not match parameters set by committed client func (cs ClientState) VerifyUpgradeAndUpdateState( ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, upgradedClient exported.ClientState, upgradedConsState exported.ConsensusState, diff --git a/testing/simapp/export.go b/testing/simapp/export.go index 618339c3bea..3d436bc4b6d 100644 --- a/testing/simapp/export.go +++ b/testing/simapp/export.go @@ -45,7 +45,7 @@ func (app *SimApp) ExportAppStateAndValidators( // prepare for fresh start at zero height // NOTE zero height genesis is a temporary feature which will be deprecated -// in favour of export at a block height +// in favour of export at a block height func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { applyAllowedAddrs := false