various linter fixes (#6106)

x/staking: Fix all linter warnings.

Fixed warnings across base packages.

New linters:
- unparam
- nolintlint

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
This commit is contained in:
Marko
2020-05-02 21:26:59 +02:00
committed by GitHub
co-authored by Alessio Treglia
parent 9251812f69
commit 218ec99508
103 changed files with 636 additions and 278 deletions
+6 -2
View File
@@ -132,7 +132,9 @@ func (ctx CLIContext) Verify(height int64) (tmtypes.SignedHeader, error) {
if ctx.Verifier == nil {
return tmtypes.SignedHeader{}, fmt.Errorf("missing valid certifier to verify data from distrusted node")
}
check, err := tmliteProxy.GetCertifiedCommit(height, ctx.Client, ctx.Verifier)
switch {
case tmliteErr.IsErrCommitNotFound(err):
return tmtypes.SignedHeader{}, ErrVerifyCommit(height)
@@ -175,8 +177,8 @@ func (ctx CLIContext) verifyProof(queryPath string, resp abci.ResponseQuery) err
}
return nil
}
err = prt.VerifyValue(resp.Proof, commit.Header.AppHash, kp.String(), resp.Value)
if err != nil {
if err := prt.VerifyValue(resp.Proof, commit.Header.AppHash, kp.String(), resp.Value); err != nil {
return errors.Wrap(err, "failed to prove merkle proof")
}
@@ -199,6 +201,7 @@ func isQueryStoreWithProof(path string) bool {
}
paths := strings.SplitN(path[1:], "/", 3)
switch {
case len(paths) != 3:
return false
@@ -218,6 +221,7 @@ func parseQueryStorePath(path string) (storeName string, err error) {
}
paths := strings.SplitN(path[1:], "/", 3)
switch {
case len(paths) != 3:
return "", errors.New("expected format like /store/<storeName>/key")
+2
View File
@@ -72,6 +72,7 @@ func GetString(prompt string, buf *bufio.Reader) (string, error) {
if err != nil {
return "", err
}
return strings.TrimSpace(out), nil
}
@@ -90,5 +91,6 @@ func readLineFromBuf(buf *bufio.Reader) (string, error) {
if err != nil {
return "", err
}
return strings.TrimSpace(pass), nil
}
+3
View File
@@ -62,6 +62,7 @@ func (rs *RestServer) Start(listenAddr string, maxOpen int, readTimeout, writeTi
if err != nil {
return
}
rs.log.Info(
fmt.Sprintf(
"Starting application REST service (chain-id: %q)...",
@@ -70,6 +71,7 @@ func (rs *RestServer) Start(listenAddr string, maxOpen int, readTimeout, writeTi
)
var h http.Handler = rs.Mux
if cors {
return rpcserver.StartHTTPServer(rs.listener, handlers.CORS()(h), rs.log, cfg)
}
@@ -111,6 +113,7 @@ func (rs *RestServer) registerSwaggerUI() {
if err != nil {
panic(err)
}
staticServer := http.FileServer(statikFS)
rs.Mux.PathPrefix("/").Handler(staticServer)
}