Skip to content

Commit

Permalink
Merge pull request #397 from okp4/fix/golangci-lint
Browse files Browse the repository at this point in the history
🐛 Bug: fix the go linter issue by updating golangci-lint
  • Loading branch information
bdeneux committed Jun 23, 2023
2 parents d931d67 + 1ea3237 commit abea475
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
uses: golangci/golangci-lint-action@v3
if: steps.changed-go-files.outputs.any_changed == 'true'
with:
version: v1.49
version: v1.53

- name: Lint go code (gofumpt)
if: steps.changed-go-files.outputs.any_changed == 'true'
Expand Down
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ func (app *App) GetSubspace(moduleName string) paramstypes.Subspace {

// RegisterAPIRoutes registers all application module routes with the provided
// API server.
func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) {
func (app *App) RegisterAPIRoutes(apiSvr *api.Server, _ config.APIConfig) {
clientCtx := apiSvr.ClientCtx
// Register new tx routes from grpc-gateway.
authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
Expand Down
2 changes: 1 addition & 1 deletion x/logic/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

// GetQueryCmd returns the cli query commands for this module.
func GetQueryCmd(queryRoute string) *cobra.Command {
func GetQueryCmd(_ string) *cobra.Command {
// Group logic queries under a subcommand
cmd := &cobra.Command{
Use: types.ModuleName,
Expand Down
3 changes: 1 addition & 2 deletions x/logic/fs/wasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (w WasmHandler) Open(ctx context.Context, uri *url.URL) (fs.File, error) {
}
query := uri.Query().Get(queryKey)

var base64Decode = true
base64Decode := true
if uri.Query().Has(base64DecodeKey) {
if base64Decode, err = strconv.ParseBool(uri.Query().Get(base64DecodeKey)); err != nil {
return nil, fmt.Errorf("failed convert 'base64Decode' query value to boolean: %w", err)
Expand Down Expand Up @@ -87,5 +87,4 @@ func (w WasmHandler) Open(ctx context.Context, uri *url.URL) (fs.File, error) {
}

return NewVirtualFile(data, uri, sdkCtx.BlockTime()), nil

}
2 changes: 1 addition & 1 deletion x/logic/migrations/v2/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/okp4/okp4d/x/logic/types"
)

func MigrateStore(ctx sdk.Context, legacySubspace exported.Subspace, cdc codec.BinaryCodec) error {
func MigrateStore(ctx sdk.Context, legacySubspace exported.Subspace, _ codec.BinaryCodec) error {
logger := ctx.Logger().
With("module", "logic").
With("migration", "v2")
Expand Down
2 changes: 1 addition & 1 deletion x/logic/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
}

// 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)
Expand Down
2 changes: 1 addition & 1 deletion x/logic/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/cosmos/cosmos-sdk/types/msgservice"
)

func RegisterCodec(cdc *codec.LegacyAmino) {
func RegisterCodec(_ *codec.LegacyAmino) {
}

func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
Expand Down
6 changes: 1 addition & 5 deletions x/logic/types/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ func (m *MsgUpdateParams) ValidateBasic() error {
return errorsmod.Wrap(err, "invalid authority address")
}

if err := m.Params.Validate(); err != nil {
return err
}

return nil
return m.Params.Validate()
}

// GetSignBytes implements the LegacyMsg interface.
Expand Down
6 changes: 1 addition & 5 deletions x/logic/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ func (p Params) Validate() error {
if err := validateInterpreter(p.Interpreter); err != nil {
return err
}
if err := validateLimits(p.Limits); err != nil {
return err
}

return nil
return validateLimits(p.Limits)
}

// String implements the Stringer interface.
Expand Down
6 changes: 3 additions & 3 deletions x/mint/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (AppModuleBasic) Name() string {
}

// RegisterLegacyAminoCodec registers the mint module's types on the given LegacyAmino codec.
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {}
func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) {}

// RegisterInterfaces registers the module's interface types.
func (b AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) {
Expand All @@ -57,7 +57,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
}

// ValidateGenesis performs genesis state validation for the mint module.
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 data types.GenesisState
if err := cdc.UnmarshalJSON(bz, &data); err != nil {
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
Expand Down Expand Up @@ -165,7 +165,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) {
}

// ProposalMsgs returns msgs used for governance proposals for simulations.
func (AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg {
func (AppModule) ProposalMsgs(_ module.SimulationState) []simtypes.WeightedProposalMsg {
return simulation.ProposalMsgs()
}

Expand Down
2 changes: 1 addition & 1 deletion x/mint/simulation/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func GenInflation(r *rand.Rand) sdk.Dec {
}

// GenAnnualReductionFactor randomized AnnualReductionFactor.
func GenAnnualReductionFactorMax(r *rand.Rand) sdk.Dec {
func GenAnnualReductionFactorMax(_ *rand.Rand) sdk.Dec {
return sdk.NewDecWithPrec(20, 2)
}

Expand Down
6 changes: 1 addition & 5 deletions x/mint/types/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ func (m *MsgUpdateParams) ValidateBasic() error {
return errorsmod.Wrap(err, "invalid authority address")
}

if err := m.Params.Validate(); err != nil {
return err
}

return nil
return m.Params.Validate()
}

// GetSignBytes implements the LegacyMsg interface.
Expand Down
10 changes: 2 additions & 8 deletions x/mint/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,8 @@ func (p Params) Validate() error {
if err := validateAnnualReductionFactor(p.AnnualReductionFactor); err != nil {
return err
}
if err := validateBlocksPerYear(p.BlocksPerYear); err != nil {
return err
}

return nil
return validateBlocksPerYear(p.BlocksPerYear)
}

// String implements the Stringer interface.
Expand All @@ -66,11 +63,8 @@ func validateMintDenom(i interface{}) error {
if strings.TrimSpace(v) == "" {
return errors.New("mint denom cannot be blank")
}
if err := sdk.ValidateDenom(v); err != nil {
return err
}

return nil
return sdk.ValidateDenom(v)
}

func validateAnnualReductionFactor(i interface{}) error {
Expand Down
2 changes: 1 addition & 1 deletion x/vesting/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (AppModuleBasic) DefaultGenesis(_ codec.JSONCodec) json.RawMessage {
}

// ValidateGenesis performs genesis state validation. Currently, this is a no-op.
func (AppModuleBasic) ValidateGenesis(_ codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error {
func (AppModuleBasic) ValidateGenesis(_ codec.JSONCodec, _ client.TxEncodingConfig, _ json.RawMessage) error {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion x/vesting/types/vesting_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ func (plva PermanentLockedAccount) LockedCoins(_ time.Time) sdk.Coins {
// TrackDelegation tracks a desired delegation amount by setting the appropriate
// values for the amount of delegated vesting, delegated free, and reducing the
// overall amount of base coins.
func (plva *PermanentLockedAccount) TrackDelegation(blockTime time.Time, balance, amount sdk.Coins) {
func (plva *PermanentLockedAccount) TrackDelegation(_ time.Time, balance, amount sdk.Coins) {
plva.BaseVestingAccount.TrackDelegation(balance, plva.OriginalVesting, amount)
}

Expand Down

0 comments on commit abea475

Please sign in to comment.