gometalinter -> golangci-lint migration (#3933)

{,scripts/}Makefile:
- Remove gometalinter, install golangci-lint.
- Remove distinction between tools and devtools.
  Just tools is enough.
- test_lint -> lint
  Migrating away from underscore separated names.
- Remove unnecessary targets.
- Drop tendermint/lint. Incompatbile with golangci-lint
  and no longer necessary anyway.
- Fix misleading message in go-mod-cache.
- New ci-target to avoid download tools twice.
- Run tests with -mod=readonly.

Port tools/gometalinter.json to .golangci.yml
Update CircleCI config accordingly.

Closes: #3896
This commit is contained in:
Alessio Treglia
2019-03-19 17:52:43 +01:00
committed by GitHub
parent faefc80769
commit cdf2b7a7c5
24 changed files with 213 additions and 131 deletions
+3 -1
View File
@@ -105,7 +105,9 @@ func makeMultiSignCmd(cdc *amino.Codec) func(cmd *cobra.Command, args []string)
if ok := stdSig.PubKey.VerifyBytes(sigBytes, stdSig.Signature); !ok {
return fmt.Errorf("couldn't verify signature")
}
multisigSig.AddSignatureFromPubKey(stdSig.Signature, stdSig.PubKey, multisigPub.PubKeys)
if err := multisigSig.AddSignatureFromPubKey(stdSig.Signature, stdSig.PubKey, multisigPub.PubKeys); err != nil {
return err
}
}
newStdSig := auth.StdSignature{Signature: cdc.MustMarshalBinaryBare(multisigSig), PubKey: multisigPub}
+9 -5
View File
@@ -43,7 +43,7 @@ $ gaiacli query gov proposal 1
var proposal gov.Proposal
cdc.MustUnmarshalJSON(res, &proposal)
return cliCtx.PrintOutput(proposal)
return cliCtx.PrintOutput(proposal) // nolint:errcheck
},
}
}
@@ -118,7 +118,7 @@ $ gaiacli query gov proposals --status (DepositPeriod|VotingPeriod|Passed|Reject
return fmt.Errorf("No matching proposals found")
}
return cliCtx.PrintOutput(matchingProposals)
return cliCtx.PrintOutput(matchingProposals) // nolint:errcheck
},
}
@@ -175,17 +175,21 @@ $ gaiacli query gov vote 1 cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk
}
var vote gov.Vote
cdc.UnmarshalJSON(res, &vote)
if err := cdc.UnmarshalJSON(res, &vote); err != nil {
return err
}
if vote.Empty() {
res, err = gcutils.QueryVoteByTxQuery(cdc, cliCtx, params)
if err != nil {
return err
}
cdc.UnmarshalJSON(res, &vote)
if err := cdc.UnmarshalJSON(res, &vote); err != nil {
return err
}
}
return cliCtx.PrintOutput(vote)
return cliCtx.PrintOutput(vote) //nolint:errcheck
},
}
}
+8 -2
View File
@@ -346,7 +346,10 @@ func queryDepositHandlerFn(cdc *codec.Codec, cliCtx context.CLIContext) http.Han
}
var deposit gov.Deposit
cdc.UnmarshalJSON(res, &deposit)
if err := cdc.UnmarshalJSON(res, &deposit); err != nil {
rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
return
}
// For an empty deposit, either the proposal does not exist or is inactive in
// which case the deposit would be removed from state and should be queried
@@ -420,7 +423,10 @@ func queryVoteHandlerFn(cdc *codec.Codec, cliCtx context.CLIContext) http.Handle
}
var vote gov.Vote
cdc.UnmarshalJSON(res, &vote)
if err := cdc.UnmarshalJSON(res, &vote); err != nil {
rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
return
}
// For an empty vote, either the proposal does not exist or is inactive in
// which case the vote would be removed from state and should be queried for