fix linter errors thrown by unconvert, goconst, and nakedret (#3960)

* Remove unnecessary type conversions

* Consolidate repeated strings into consts

* Clothe return statements

* Update blockchain/v1/reactor_fsm_test.go

Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>

This PR repairs linter errors seen when running the following commands:
golangci-lint run --no-config --disable-all=true --enable=unconvert
golangci-lint run --no-config --disable-all=true --enable=goconst
golangci-lint run --no-config --disable-all=true --enable=nakedret

Contributes to #3262
This commit is contained in:
Phil Salant
2019-09-10 03:31:44 -04:00
committed by Anton Kaliaev
parent 7f0c55f249
commit 04d13d9945
31 changed files with 69 additions and 59 deletions

View File

@ -39,17 +39,17 @@ func TestResponses(t *testing.T) {
a := NewRPCSuccessResponse(cdc, jsonid, &SampleResult{"hello"})
b, _ := json.Marshal(a)
s := fmt.Sprintf(`{"jsonrpc":"2.0","id":%v,"result":{"Value":"hello"}}`, tt.expected)
assert.Equal(string(s), string(b))
assert.Equal(s, string(b))
d := RPCParseError(jsonid, errors.New("Hello world"))
e, _ := json.Marshal(d)
f := fmt.Sprintf(`{"jsonrpc":"2.0","id":%v,"error":{"code":-32700,"message":"Parse error. Invalid JSON","data":"Hello world"}}`, tt.expected)
assert.Equal(string(f), string(e))
assert.Equal(f, string(e))
g := RPCMethodNotFoundError(jsonid)
h, _ := json.Marshal(g)
i := fmt.Sprintf(`{"jsonrpc":"2.0","id":%v,"error":{"code":-32601,"message":"Method not found"}}`, tt.expected)
assert.Equal(string(h), string(i))
assert.Equal(string(h), i)
}
}