Fix lint error and add linter CI workflow
This commit is contained in:
parent
2d2e5b7560
commit
593a767a06
27
.gitea/workflows/lint.yml
Normal file
27
.gitea/workflows/lint.yml
Normal file
@ -0,0 +1,27 @@
|
||||
name: Lint
|
||||
# Lint runs golangci-lint over the entire repository This workflow is
|
||||
# run on every pull request and push to main The `golangci` will pass without
|
||||
# running if no *.{go, mod, sum} files have been changed.
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
golangci:
|
||||
name: Run golangci-lint
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
# Required: setup-go, for all versions v3.0.0+ of golangci-lint
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.21
|
||||
check-latest: true
|
||||
- uses: actions/checkout@v3
|
||||
- uses: golangci/golangci-lint-action@v3.3.1
|
||||
with:
|
||||
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
|
||||
version: latest
|
||||
args: --timeout 10m
|
||||
github-token: ${{ secrets.github_token }}
|
@ -73,7 +73,7 @@ func (app *LaconicApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
|
||||
/* Handle fee distribution state. */
|
||||
|
||||
// withdraw all validator commission
|
||||
app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
|
||||
_ = app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
|
||||
valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@ -114,7 +114,7 @@ func (app *LaconicApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
|
||||
ctx = ctx.WithBlockHeight(0)
|
||||
|
||||
// reinitialize all validators
|
||||
app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
|
||||
_ = app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
|
||||
valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@ -171,20 +171,20 @@ func (app *LaconicApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
|
||||
/* Handle staking state. */
|
||||
|
||||
// iterate through redelegations, reset creation height
|
||||
app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) {
|
||||
_ = app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) {
|
||||
for i := range red.Entries {
|
||||
red.Entries[i].CreationHeight = 0
|
||||
}
|
||||
app.StakingKeeper.SetRedelegation(ctx, red)
|
||||
_ = app.StakingKeeper.SetRedelegation(ctx, red)
|
||||
return false
|
||||
})
|
||||
|
||||
// iterate through unbonding delegations, reset creation height
|
||||
app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) {
|
||||
_ = app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) {
|
||||
for i := range ubd.Entries {
|
||||
ubd.Entries[i].CreationHeight = 0
|
||||
}
|
||||
app.StakingKeeper.SetUnbondingDelegation(ctx, ubd)
|
||||
_ = app.StakingKeeper.SetUnbondingDelegation(ctx, ubd)
|
||||
return false
|
||||
})
|
||||
|
||||
@ -208,7 +208,7 @@ func (app *LaconicApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
|
||||
validator.Jailed = true
|
||||
}
|
||||
|
||||
app.StakingKeeper.SetValidator(ctx, validator)
|
||||
_ = app.StakingKeeper.SetValidator(ctx, validator)
|
||||
counter++
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
types "github.com/cosmos/cosmos-sdk/types"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
|
||||
@ -216,7 +217,7 @@ func (q queryResolver) GetAccount(ctx context.Context, address string) (*Account
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var account authtypes.AccountI
|
||||
var account types.AccountI
|
||||
err = q.ctx.Codec.UnpackAny(accountResponse.GetAccount(), &account)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -130,19 +130,16 @@ func (ets *E2ETestSuite) createAuctionAndBid(createAuction, createBid bool) stri
|
||||
return auctionId
|
||||
}
|
||||
|
||||
func (ets *E2ETestSuite) cleanupBidFiles() error {
|
||||
func (ets *E2ETestSuite) cleanupBidFiles() {
|
||||
matches, err := filepath.Glob(fmt.Sprintf("%s-*.json", bidderAccount))
|
||||
if err != nil {
|
||||
ets.T().Errorf("Error matching bidder files: %v\n", err)
|
||||
return err
|
||||
}
|
||||
|
||||
for _, match := range matches {
|
||||
err := os.Remove(match)
|
||||
if err != nil {
|
||||
return err
|
||||
ets.T().Errorf("Error removing bidder file: %v\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -25,10 +25,11 @@ type KeeperTestSuite struct {
|
||||
}
|
||||
|
||||
func (kts *KeeperTestSuite) SetupTest() {
|
||||
kts.TestFixture.Setup()
|
||||
err := kts.TestFixture.Setup()
|
||||
assert.Nil(kts.T(), err)
|
||||
|
||||
// set default params
|
||||
err := kts.RegistryKeeper.Params.Set(kts.SdkCtx, types.DefaultParams())
|
||||
err = kts.RegistryKeeper.Params.Set(kts.SdkCtx, types.DefaultParams())
|
||||
assert.Nil(kts.T(), err)
|
||||
|
||||
qr := kts.App.QueryHelper()
|
||||
|
Loading…
Reference in New Issue
Block a user