gocritic (1/2) (#3836)

Add gocritic as a linter

    The linting is not complete, but should i complete in this PR or in a following.

    23 files have been touched so it may be better to do in a following PR


Commits:

* Add gocritic to linting

- Added gocritic to linting

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>

* gocritic

* pr comments

* remove switch in cmdBatch
This commit is contained in:
Marko
2019-07-30 18:13:35 +04:00
committed by Anton Kaliaev
parent 88e0973f7d
commit 41bf54a906
23 changed files with 89 additions and 123 deletions
+2 -4
View File
@@ -72,10 +72,8 @@ func (genDoc *GenesisDoc) ValidateAndComplete() error {
if genDoc.ConsensusParams == nil {
genDoc.ConsensusParams = DefaultConsensusParams()
} else {
if err := genDoc.ConsensusParams.Validate(); err != nil {
return err
}
} else if err := genDoc.ConsensusParams.Validate(); err != nil {
return err
}
for i, v := range genDoc.Validators {
+2 -2
View File
@@ -121,7 +121,7 @@ func (vals *ValidatorSet) RescalePriorities(diffMax int64) {
ratio := (diff + diffMax - 1) / diffMax
if diff > diffMax {
for _, val := range vals.Validators {
val.ProposerPriority = val.ProposerPriority / ratio
val.ProposerPriority /= ratio
}
}
}
@@ -525,7 +525,7 @@ func (vals *ValidatorSet) applyRemovals(deletes []*Validator) {
// The 'allowDeletes' flag is set to false by NewValidatorSet() and to true by UpdateWithChangeSet().
func (vals *ValidatorSet) updateWithChangeSet(changes []*Validator, allowDeletes bool) error {
if len(changes) <= 0 {
if len(changes) == 0 {
return nil
}