-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Goimports #4881
Goimports #4881
Conversation
- maligned | ||
- nakedret | ||
- ineffassign | ||
- errcheck |
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 should be enabled
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.
lots of errors, some stuff is steaming from tests, i can disable this, or would we want the errrors on tests as well?
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, blocked on the testing refactors
- govet | ||
- unused | ||
- deadcode | ||
- golint |
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 should be enabled
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.
it currently has about 20+ errors, can spend time next week enabling it
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.
will enable this after @colin-axner 's testing refactors have been merged
Codecov Report
@@ Coverage Diff @@
## master #4881 +/- ##
==========================================
+ Coverage 53.74% 53.74% +<.01%
==========================================
Files 272 272
Lines 17105 17103 -2
==========================================
- Hits 9193 9192 -1
- Misses 7221 7224 +3
+ Partials 691 687 -4 |
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.
ACK
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
@marbar3778 please signal when this is r4r again. |
@alexanderbez its ready, just knocked another linter out quickly |
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
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.
ACK still stands. We should also enabled unparam
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.
Good cleanup - I have several suggestions, but also there are some tests which should have not been deleted which should be reinstated (this last comment is blocking for me)
@@ -292,146 +292,6 @@ func TestValidatorBasics(t *testing.T) { | |||
require.False(t, found) | |||
} | |||
|
|||
// test how the validators are sorted, tests GetBondedValidatorsByPower | |||
func GetValidatorSortingUnmixed(t *testing.T) { |
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 was this test deleted? These are vital tests of functionality which must be kept unless this is clearly duplicated somewhere (blocking comment)
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.
i got this as unused code and couldn't find its uses used in the codebase, do we want to keep unused code around? I'm fine with putting it back
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.
We definitely want both these tests which have been deleted in this file
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.
just for the heads up these tests fail and arent currently run, will put them back in and comment them out
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.
@marko, let's not comment them out, but rather add t.SkipNow()
at the very top of the test function. Also, let's open up an issue and reference it to be fixed asap.
i.e.
func GetValidatorSortingUnmixed(t *testing.T) {
// TODO: Evaluate and fix broken unit test.
// ref: link
t.SkipNow()
// ...
}
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.
I second @alexanderbez
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.
added it in
@@ -135,7 +135,7 @@ func AppStateFromGenesisFileFn(r *rand.Rand, config simulation.Config) (json.Raw | |||
r.Read(privkeySeed) | |||
|
|||
privKey := secp256k1.GenPrivKeySecp256k1(privkeySeed) | |||
newAccs = append(newAccs, simulation.Account{privKey, privKey.PubKey(), acc.Address}) | |||
newAccs = append(newAccs, simulation.Account{PrivKey: privKey, PubKey: privKey.PubKey(), Address: acc.Address}) |
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.
Create and use a new function simulation.NewAccount(......
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 isn’t necessary (as in it shouldn’t be blocking) but can be added if the constructor is concise.
@@ -82,9 +82,8 @@ func PrefixEndBytes(prefix []byte) []byte { | |||
|
|||
// InclusiveEndBytes returns the []byte that would end a | |||
// range query such that the input would be included | |||
func InclusiveEndBytes(inclusiveBytes []byte) (exclusiveBytes []byte) { | |||
exclusiveBytes = append(inclusiveBytes, byte(0x00)) | |||
return exclusiveBytes |
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.
I would recommend reverting this change, even though it's more verbose, I find the variable names helpful in understanding this functionality
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.
would it be better to better the comment instead of reverting?
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.
I think the variables would be clearer than a comment. But this is minor for me
@@ -156,7 +156,7 @@ func ExportGenesis(ctx sdk.Context, keeper Keeper) types.GenesisState { | |||
}) | |||
var lastValidatorPowers []types.LastValidatorPower | |||
keeper.IterateLastValidatorPowers(ctx, func(addr sdk.ValAddress, power int64) (stop bool) { | |||
lastValidatorPowers = append(lastValidatorPowers, types.LastValidatorPower{addr, power}) | |||
lastValidatorPowers = append(lastValidatorPowers, types.LastValidatorPower{Address: addr, Power: power}) |
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.
Create and use a new function types.NewLastValidatorPower(.......
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
…-sdk into marko/addgoimports
@@ -292,146 +292,6 @@ func TestValidatorBasics(t *testing.T) { | |||
require.False(t, found) | |||
} | |||
|
|||
// test how the validators are sorted, tests GetBondedValidatorsByPower | |||
func GetValidatorSortingUnmixed(t *testing.T) { |
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.
@marko, let's not comment them out, but rather add t.SkipNow()
at the very top of the test function. Also, let's open up an issue and reference it to be fixed asap.
i.e.
func GetValidatorSortingUnmixed(t *testing.T) {
// TODO: Evaluate and fix broken unit test.
// ref: link
t.SkipNow()
// ...
}
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.
ACK; we should open up an issue for those two failing tests though.
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.
ACK - provided (@alexanderbez new comment is addressed) #4881 (comment)
👏 🌟 🌵
ref #4589
Signed-off-by: Marko Baricevic marbar3778@yahoo.com
Targeted PR against correct branch (see CONTRIBUTING.md)
Linked to github-issue with discussion and accepted design OR link to spec that describes this work.
Wrote tests
Updated relevant documentation (
docs/
)Added a relevant changelog entry:
clog add [section] [-t <tag>] [-m <msg>]
Re-reviewed
Files changed
in the github PR explorerFor Admin Use: