diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml new file mode 100644 index 00000000..82c56a7b --- /dev/null +++ b/.gitea/workflows/lint.yml @@ -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 }} diff --git a/app/export.go b/app/export.go index 81178cc9..cd119a3e 100644 --- a/app/export.go +++ b/app/export.go @@ -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++ } diff --git a/gql/resolver.go b/gql/resolver.go index 1e7fab7a..ca300885 100644 --- a/gql/resolver.go +++ b/gql/resolver.go @@ -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 diff --git a/tests/e2e/auction/suite.go b/tests/e2e/auction/suite.go index ce322258..717ed1e1 100644 --- a/tests/e2e/auction/suite.go +++ b/tests/e2e/auction/suite.go @@ -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 } diff --git a/tests/integration/registry/keeper/common_test.go b/tests/integration/registry/keeper/common_test.go index 05712894..0dba8fe6 100644 --- a/tests/integration/registry/keeper/common_test.go +++ b/tests/integration/registry/keeper/common_test.go @@ -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()