-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: enable errcheck
linter
#16406
Conversation
errcheck
lintererrcheck
linter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like omitting the errors at many places and also pending @julienrbrt 's comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comments as julien and atheesh
Can you also resolve the conflicts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! thank you @ruthishvitwit!
Hey thanks @ruthishvitwit this is one of the linters that helps me sleep at night |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly lgtm, a few nits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other than atheesh's comments and few nits, mostly looks good.
There are also some failing tests. Can you please take a look at them ?
@ruthishvitwit, could you fix the conflict and implement the last comments from Atheesh, so we can merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two tests are failing, could you have a look?
x/gov/keeper/proposal_test.go
Outdated
suite.govKeeper.SetProposal(suite.ctx, proposal) | ||
err = suite.govKeeper.SetProposal(suite.ctx, proposal) | ||
suite.Require().NoError(err) | ||
err = suite.govKeeper.SetProposal(suite.ctx, proposal) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this duplicated?
x/gov/keeper/proposal_test.go
Outdated
err = suite.govKeeper.SetProposal(suite.ctx, proposal) | ||
suite.Require().NoError(err) | ||
|
||
err = suite.govKeeper.SetProposal(suite.ctx, proposal) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
@julienrbrt I am not able to solve the errors in the tests which are failing . Will u be able to take a look at it once?? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the first test failing it is fine to do not check the error.
For the second TestRollback
, we should ensure there are validators, so you need to update the genesis (app.DefaultGenesis
) and add some validators (e.g.
cosmos-sdk/simapp/test_helpers.go
Line 76 in 4c6096c
genesisState, err = simtestutil.GenesisStateWithValSet(app.AppCodec(), genesisState, valSet, []authtypes.GenesisAccount{acc}, balance) |
tests/e2e/staking/suite.go
Outdated
@@ -153,4 +153,5 @@ func (s *E2ETestSuite) TestBlockResults() { | |||
|
|||
return nil | |||
}, 10) | |||
require.NoError(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ok to ignore, as it may fail as the first few blocks, and this is why we retry for 10 blocks.
This will "fix" the test issue you have.
Can you fix the conflicts and let's merge! |
(cherry picked from commit fd7e549) # Conflicts: # .golangci.yml # simapp/internal/testnet/cometrpc_test.go # simapp/internal/testnet/cometstarter_test.go # simapp/internal/testnet/example_basic_test.go # tests/integration/distribution/keeper/msg_server_test.go # tests/integration/gov/keeper/keeper_test.go # tests/integration/slashing/keeper/keeper_test.go # x/distribution/simulation/operations_test.go # x/slashing/keeper/genesis_test.go # x/slashing/keeper/keeper_test.go # x/slashing/simulation/operations_test.go
Description
The aim of this pr is to solve and fix all the errors after enabling Errcheck.I have made some of changes in a way i could understand the issue.Please suggest any changes or pointout any errors
Closes: #16293
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change