diff --git a/.golangci.yml b/.golangci.yml index 0da89721..54a9d645 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -6,7 +6,7 @@ run: linters: enable: # - bodyclose - - depguard + # - depguard - dogsled - dupl - errcheck diff --git a/x/yield/client/cli/query.go b/x/yield/client/cli/query.go index 58ae5e0f..4e466791 100644 --- a/x/yield/client/cli/query.go +++ b/x/yield/client/cli/query.go @@ -14,7 +14,7 @@ import ( ) // GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { +func GetQueryCmd(_ string) *cobra.Command { // Group yield queries under a subcommand cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/yield/client/cli/tx.go b/x/yield/client/cli/tx.go index b21944e1..bee8393f 100644 --- a/x/yield/client/cli/tx.go +++ b/x/yield/client/cli/tx.go @@ -11,14 +11,12 @@ import ( "github.com/sideprotocol/side/x/yield/types" ) -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) +var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) +// const ( +// flagPacketTimeoutTimestamp = "packet-timeout-timestamp" +// listSeparator = "," +// ) // GetTxCmd returns the transaction commands for this module func GetTxCmd() *cobra.Command { diff --git a/x/yield/keeper/host_chain.go b/x/yield/keeper/host_chain.go index e8e198a7..12325b84 100644 --- a/x/yield/keeper/host_chain.go +++ b/x/yield/keeper/host_chain.go @@ -92,9 +92,8 @@ func (k Keeper) IterateHostChains(ctx sdk.Context, fn func(ctx sdk.Context, inde zone := types.HostChain{} k.cdc.MustUnmarshal(iterator.Value(), &zone) - error := fn(ctx, i, zone) - - if error != nil { + err := fn(ctx, i, zone) + if err != nil { break } i++ diff --git a/x/yield/keeper/params.go b/x/yield/keeper/params.go index 8ad89d93..c5deed5d 100644 --- a/x/yield/keeper/params.go +++ b/x/yield/keeper/params.go @@ -6,7 +6,7 @@ import ( ) // GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { +func (k Keeper) GetParams(_ sdk.Context) types.Params { return types.NewParams() } diff --git a/x/yield/module.go b/x/yield/module.go index 48385f7c..038c8830 100644 --- a/x/yield/module.go +++ b/x/yield/module.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + // this line is used by starport scaffolding # 1 "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -54,13 +55,13 @@ func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { types.RegisterInterfaces(reg) } -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing +// DefaultGenesis returns a default GenesisState for the module, marshaled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { return cdc.MustMarshalJSON(types.DefaultGenesis()) } // ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var genState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -70,7 +71,9 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } } // GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module diff --git a/x/yield/module_simulation.go b/x/yield/module_simulation.go index 761f5553..6445320b 100644 --- a/x/yield/module_simulation.go +++ b/x/yield/module_simulation.go @@ -23,7 +23,7 @@ var ( ) const ( - opWeightMsgRegisterHostChain = "op_weight_msg_register_host_chain" + opWeightMsgRegisterHostChain = "op_weight_msg_register_host_chain" // #nosec // TODO: Determine the simulation weight value defaultWeightMsgRegisterHostChain int = 100 @@ -72,7 +72,7 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp } // ProposalMsgs returns msgs used for governance proposals for simulations. -func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { +func (am AppModule) ProposalMsgs(_ module.SimulationState) []simtypes.WeightedProposalMsg { return []simtypes.WeightedProposalMsg{ simulation.NewWeightedProposalMsg( opWeightMsgRegisterHostChain, diff --git a/x/yield/simulation/register_host_chain.go b/x/yield/simulation/register_host_chain.go index 50922095..252dabbf 100644 --- a/x/yield/simulation/register_host_chain.go +++ b/x/yield/simulation/register_host_chain.go @@ -11,9 +11,9 @@ import ( ) func SimulateMsgRegisterHostChain( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, + _ types.AccountKeeper, + _ types.BankKeeper, + _ keeper.Keeper, ) simtypes.Operation { return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { diff --git a/x/yield/types/message_register_host_chain.go b/x/yield/types/message_register_host_chain.go index 7f98c647..a9c1c3c4 100644 --- a/x/yield/types/message_register_host_chain.go +++ b/x/yield/types/message_register_host_chain.go @@ -1,6 +1,7 @@ package types import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -51,7 +52,7 @@ func (msg *MsgRegisterHostChain) GetSignBytes() []byte { func (msg *MsgRegisterHostChain) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil }