Skip to content

Commit

Permalink
Fix golang linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeniy-scherbina committed Apr 9, 2024
1 parent 8c395ac commit 5a17ea8
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ issues:
- path: \.pb.go
linters:
- lll
- path: rpc/websockets.go
text: 'G114: Use of net/http serve function that has no support for setting timeouts'
max-same-issues: 50

linters-settings:
Expand Down
7 changes: 5 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,10 @@ func NewEthermintApp(
capability.NewAppModule(appCodec, *app.CapabilityKeeper, false),
feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry),
gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)),
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName)),
slashing.NewAppModule(
appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper,
app.GetSubspace(slashingtypes.ModuleName),
),
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)),
staking.NewAppModule(appCodec, &app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)),
upgrade.NewAppModule(&app.UpgradeKeeper),
Expand Down Expand Up @@ -865,7 +868,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(minttypes.ModuleName)
paramsKeeper.Subspace(distrtypes.ModuleName)
paramsKeeper.Subspace(slashingtypes.ModuleName)
paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable())
paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()) //nolint:staticcheck
paramsKeeper.Subspace(crisistypes.ModuleName)
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibcexported.ModuleName)
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

func (app *EthermintApp) RegisterUpgradeHandlers() {
planName := "integration-test-upgrade"
app.UpgradeKeeper.SetUpgradeHandler(planName, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
app.UpgradeKeeper.SetUpgradeHandler(planName, func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
})
}
8 changes: 7 additions & 1 deletion app/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,13 @@ func genesisStateWithValSet(codec codec.Codec, genesisState simapp.GenesisState,
})

// update total supply
bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}, []banktypes.SendEnabled{})
bankGenesis := banktypes.NewGenesisState(
banktypes.DefaultGenesisState().Params,
balances,
totalSupply,
[]banktypes.Metadata{},
[]banktypes.SendEnabled{},
)
genesisState[banktypes.ModuleName] = codec.MustMarshalJSON(bankGenesis)

return genesisState
Expand Down
3 changes: 1 addition & 2 deletions client/keys/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ package keys
import (
"bufio"
"bytes"
"encoding/json"
"errors"
"fmt"
"sort"

"encoding/json"

etherminthd "github.com/evmos/ethermint/crypto/hd"

bip39 "github.com/cosmos/go-bip39"
Expand Down
12 changes: 10 additions & 2 deletions client/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ func initGenFiles(
var govGenState govv1.GenesisState
clientCtx.Codec.MustUnmarshalJSON(appGenState[govtypes.ModuleName], &govGenState)

govGenState.DepositParams.MinDeposit[0].Denom = coinDenom
govGenState.Params.MinDeposit[0].Denom = coinDenom
appGenState[govtypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(&govGenState)

var mintGenState mintypes.GenesisState
Expand Down Expand Up @@ -491,7 +491,15 @@ func collectGenFiles(
return err
}

nodeAppState, err := genutil.GenAppStateFromConfig(clientCtx.Codec, clientCtx.TxConfig, nodeConfig, initCfg, *genDoc, genBalIterator, genutiltypes.DefaultMessageValidator)
nodeAppState, err := genutil.GenAppStateFromConfig(
clientCtx.Codec,
clientCtx.TxConfig,
nodeConfig,
initCfg,
*genDoc,
genBalIterator,
genutiltypes.DefaultMessageValidator,
)
if err != nil {
return err
}
Expand Down
2 changes: 0 additions & 2 deletions rpc/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ type EVMBackend interface {

var _ BackendI = (*Backend)(nil)

var bAttributeKeyEthereumBloom = []byte(evmtypes.AttributeKeyEthereumBloom)

// Backend implements the BackendI interface
type Backend struct {
ctx context.Context
Expand Down
2 changes: 1 addition & 1 deletion rpc/backend/blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ func (b *Backend) TendermintBlockResultByNumber(height *int64) (*tmrpctypes.Resu
if !ok {
b.logger.Error("invalid rpc client")
return nil, errors.New("invalid rpc client")

}

return sc.BlockResults(b.ctx, height)
}

Expand Down
2 changes: 1 addition & 1 deletion rpc/types/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func BaseFeeFromEvents(events []abci.Event) *big.Int {

for _, attr := range event.Attributes {
if attr.Key == feemarkettypes.AttributeKeyBaseFee {
result, success := new(big.Int).SetString(string(attr.Value), 10)
result, success := new(big.Int).SetString(attr.Value, 10)
if success {
return result
}
Expand Down
2 changes: 1 addition & 1 deletion rpc/websockets.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (s *websocketsServer) Start() {

func (s *websocketsServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
upgrader := websocket.Upgrader{
CheckOrigin: func(r *http.Request) bool {
CheckOrigin: func(_ *http.Request) bool {
return true
},
}
Expand Down
4 changes: 2 additions & 2 deletions x/feemarket/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func GetBlockGasCmd() *cobra.Command {
Long: `Get the block gas used at a given block height.
If the height is not provided, it will use the latest height from context`,
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
Expand Down Expand Up @@ -108,7 +108,7 @@ func GetBaseFeeCmd() *cobra.Command {
Long: `Get the base fee amount at a given block height.
If the height is not provided, it will use the latest height from context.`,
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
Expand Down

0 comments on commit 5a17ea8

Please sign in to comment.