lint: s/+=1/++, remove else clauses

This commit is contained in:
Tzu-Jung Lee
2017-01-17 00:30:36 -08:00
parent af2a66b226
commit 55cb08722d
8 changed files with 32 additions and 42 deletions
+2 -2
View File
@@ -64,12 +64,12 @@ func (app *ChainAwareApplication) Query(query []byte) types.Result {
}
func (app *ChainAwareApplication) BeginBlock(hash []byte, header *types.Header) {
app.beginCount += 1
app.beginCount++
return
}
func (app *ChainAwareApplication) EndBlock(height uint64) (resEndBlock types.ResponseEndBlock) {
app.endCount += 1
app.endCount++
return
}
+5 -7
View File
@@ -40,7 +40,7 @@ func (app *CounterApplication) DeliverTx(tx []byte) types.Result {
return types.ErrBadNonce.SetLog(fmt.Sprintf("Invalid nonce. Expected %v, got %v", app.txCount, txValue))
}
}
app.txCount += 1
app.txCount++
return types.OK
}
@@ -60,15 +60,13 @@ func (app *CounterApplication) CheckTx(tx []byte) types.Result {
}
func (app *CounterApplication) Commit() types.Result {
app.hashCount += 1
app.hashCount++
if app.txCount == 0 {
return types.OK
} else {
hash := make([]byte, 8)
binary.BigEndian.PutUint64(hash, uint64(app.txCount))
return types.NewResultOK(hash, "")
}
hash := make([]byte, 8)
binary.BigEndian.PutUint64(hash, uint64(app.txCount))
return types.NewResultOK(hash, "")
}
func (app *CounterApplication) Query(query []byte) types.Result {
+2 -2
View File
@@ -60,7 +60,7 @@ func testStream(t *testing.T, app types.Application) {
// Process response
switch r := res.Value.(type) {
case *types.Response_DeliverTx:
counter += 1
counter++
if r.DeliverTx.Code != types.CodeType_OK {
t.Error("DeliverTx failed with ret_code", r.DeliverTx.Code)
}
@@ -135,7 +135,7 @@ func testGRPCSync(t *testing.T, app *types.GRPCApplication) {
if err != nil {
t.Fatalf("Error in GRPC DeliverTx: %v", err.Error())
}
counter += 1
counter++
if response.Code != types.CodeType_OK {
t.Error("DeliverTx failed with ret_code", response.Code)
}