Commit caed05f3 authored by vipwzw's avatar vipwzw

fix vet

parent 7b6003c9
...@@ -74,7 +74,7 @@ updatevendor: ...@@ -74,7 +74,7 @@ updatevendor:
dep: dep:
dep init -v dep init -v
linter: ## Use gometalinter check code, ignore some unserious warning linter: vet ## Use gometalinter check code, ignore some unserious warning
@./golinter.sh "filter" @./golinter.sh "filter"
@find . -name '*.sh' -not -path "./vendor/*" | xargs shellcheck @find . -name '*.sh' -not -path "./vendor/*" | xargs shellcheck
......
...@@ -2,14 +2,13 @@ ...@@ -2,14 +2,13 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build go1.9
/* /*
每个系统的功能通过插件完成,插件分成4类: 每个系统的功能通过插件完成,插件分成4类:
共识 加密 dapp 存储 共识 加密 dapp 存储
这个go 包提供了 官方提供的 插件。 这个go 包提供了 官方提供的 插件。
*/ */
// +build go1.9
package main package main
import ( import (
......
...@@ -1180,7 +1180,7 @@ func (cs *ConsensusState) defaultSetProposal(proposal *tmtypes.Proposal) error { ...@@ -1180,7 +1180,7 @@ func (cs *ConsensusState) defaultSetProposal(proposal *tmtypes.Proposal) error {
// NOTE: block is not necessarily valid. // NOTE: block is not necessarily valid.
// Asynchronously triggers either enterPrevote (before we timeout of propose) or tryFinalizeCommit, once we have the full block. // Asynchronously triggers either enterPrevote (before we timeout of propose) or tryFinalizeCommit, once we have the full block.
func (cs *ConsensusState) addProposalBlock(proposalBlock *tmtypes.TendermintBlock) (err error) { func (cs *ConsensusState) addProposalBlock(proposalBlock *tmtypes.TendermintBlock) (err error) {
block := &ttypes.TendermintBlock{proposalBlock} block := &ttypes.TendermintBlock{TendermintBlock: proposalBlock}
height, round := block.Header.Height, block.Header.Round height, round := block.Header.Height, block.Header.Round
tendermintlog.Debug(fmt.Sprintf("Consensus receive proposal block. Current: %v/%v/%v", cs.Height, cs.Round, cs.Step), tendermintlog.Debug(fmt.Sprintf("Consensus receive proposal block. Current: %v/%v/%v", cs.Height, cs.Round, cs.Step),
"block(H/R/hash)", fmt.Sprintf("%v/%v/%X", height, round, block.Hash())) "block(H/R/hash)", fmt.Sprintf("%v/%v/%X", height, round, block.Hash()))
......
...@@ -117,7 +117,7 @@ func (action *Action) GetIndex(game *gt.Game) int64 { ...@@ -117,7 +117,7 @@ func (action *Action) GetIndex(game *gt.Game) int64 {
//GetKVSet get kv set //GetKVSet get kv set
func (action *Action) GetKVSet(game *gt.Game) (kvset []*types.KeyValue) { func (action *Action) GetKVSet(game *gt.Game) (kvset []*types.KeyValue) {
value := types.Encode(game) value := types.Encode(game)
kvset = append(kvset, &types.KeyValue{Key(game.GameId), value}) kvset = append(kvset, &types.KeyValue{Key: Key(game.GameId), Value: value})
return kvset return kvset
} }
...@@ -126,7 +126,7 @@ func (action *Action) updateCount(status int32, addr string) (kvset []*types.Key ...@@ -126,7 +126,7 @@ func (action *Action) updateCount(status int32, addr string) (kvset []*types.Key
if err != nil { if err != nil {
glog.Error("updateCount", "Query count have err:", err.Error()) glog.Error("updateCount", "Query count have err:", err.Error())
} }
kvset = append(kvset, &types.KeyValue{calcCountKey(status, addr), []byte(strconv.FormatInt(count+1, 10))}) kvset = append(kvset, &types.KeyValue{Key: calcCountKey(status, addr), Value: []byte(strconv.FormatInt(count+1, 10))})
return kvset return kvset
} }
...@@ -231,7 +231,7 @@ func (action *Action) GameCreate(create *gt.GameCreate) (*types.Receipt, error) ...@@ -231,7 +231,7 @@ func (action *Action) GameCreate(create *gt.GameCreate) (*types.Receipt, error)
kv = append(kv, receipt.KV...) kv = append(kv, receipt.KV...)
kv = append(kv, action.updateCount(game.GetStatus(), "")...) kv = append(kv, action.updateCount(game.GetStatus(), "")...)
kv = append(kv, action.updateCount(game.GetStatus(), game.GetCreateAddress())...) kv = append(kv, action.updateCount(game.GetStatus(), game.GetCreateAddress())...)
receipt = &types.Receipt{types.ExecOk, kv, logs} receipt = &types.Receipt{Ty: types.ExecOk, KV: kv, Logs: logs}
return receipt, nil return receipt, nil
} }
...@@ -286,7 +286,7 @@ func (action *Action) GameMatch(match *gt.GameMatch) (*types.Receipt, error) { ...@@ -286,7 +286,7 @@ func (action *Action) GameMatch(match *gt.GameMatch) (*types.Receipt, error) {
kvs = append(kvs, action.updateCount(game.GetStatus(), "")...) kvs = append(kvs, action.updateCount(game.GetStatus(), "")...)
kvs = append(kvs, action.updateCount(game.GetStatus(), game.GetCreateAddress())...) kvs = append(kvs, action.updateCount(game.GetStatus(), game.GetCreateAddress())...)
kvs = append(kvs, action.updateCount(game.GetStatus(), game.GetMatchAddress())...) kvs = append(kvs, action.updateCount(game.GetStatus(), game.GetMatchAddress())...)
receipts := &types.Receipt{types.ExecOk, kvs, logs} receipts := &types.Receipt{Ty: types.ExecOk, KV: kvs, Logs: logs}
return receipts, nil return receipts, nil
} }
...@@ -338,7 +338,7 @@ func (action *Action) GameCancel(cancel *gt.GameCancel) (*types.Receipt, error) ...@@ -338,7 +338,7 @@ func (action *Action) GameCancel(cancel *gt.GameCancel) (*types.Receipt, error)
kv = append(kv, action.updateCount(game.GetStatus(), "")...) kv = append(kv, action.updateCount(game.GetStatus(), "")...)
kv = append(kv, action.updateCount(game.GetStatus(), game.GetCreateAddress())...) kv = append(kv, action.updateCount(game.GetStatus(), game.GetCreateAddress())...)
return &types.Receipt{types.ExecOk, kv, logs}, nil return &types.Receipt{Ty: types.ExecOk, KV: kv, Logs: logs}, nil
} }
// GameClose close game // GameClose close game
...@@ -480,7 +480,7 @@ func (action *Action) GameClose(close *gt.GameClose) (*types.Receipt, error) { ...@@ -480,7 +480,7 @@ func (action *Action) GameClose(close *gt.GameClose) (*types.Receipt, error) {
kv = append(kv, action.updateCount(game.GetStatus(), "")...) kv = append(kv, action.updateCount(game.GetStatus(), "")...)
kv = append(kv, action.updateCount(game.GetStatus(), game.GetCreateAddress())...) kv = append(kv, action.updateCount(game.GetStatus(), game.GetCreateAddress())...)
kv = append(kv, action.updateCount(game.GetStatus(), game.GetMatchAddress())...) kv = append(kv, action.updateCount(game.GetStatus(), game.GetMatchAddress())...)
return &types.Receipt{types.ExecOk, kv, logs}, nil return &types.Receipt{Ty: types.ExecOk, KV: kv, Logs: logs}, nil
} }
// 检查开奖是否超时,若超过一天,则不让庄家开奖,但其他人可以开奖, // 检查开奖是否超时,若超过一天,则不让庄家开奖,但其他人可以开奖,
...@@ -602,7 +602,7 @@ func queryGameListByStatusAndAddr(db dbm.Lister, stateDB dbm.KV, param *gt.Query ...@@ -602,7 +602,7 @@ func queryGameListByStatusAndAddr(db dbm.Lister, stateDB dbm.KV, param *gt.Query
} }
gameIds = append(gameIds, record.GetGameId()) gameIds = append(gameIds, record.GetGameId())
} }
return &gt.ReplyGameList{GetGameList(stateDB, gameIds)}, nil return &gt.ReplyGameList{Games: GetGameList(stateDB, gameIds)}, nil
} }
// QueryGameListCount count数查询 // QueryGameListCount count数查询
...@@ -610,7 +610,7 @@ func QueryGameListCount(stateDB dbm.KV, param *gt.QueryGameListCount) (types.Mes ...@@ -610,7 +610,7 @@ func QueryGameListCount(stateDB dbm.KV, param *gt.QueryGameListCount) (types.Mes
if param.Status < 1 || param.Status > 4 { if param.Status < 1 || param.Status > 4 {
return nil, fmt.Errorf("%s", "the status only fill in 1,2,3,4!") return nil, fmt.Errorf("%s", "the status only fill in 1,2,3,4!")
} }
return &gt.ReplyGameListCount{QueryCountByStatusAndAddr(stateDB, param.GetStatus(), param.GetAddress())}, nil return &gt.ReplyGameListCount{Count: QueryCountByStatusAndAddr(stateDB, param.GetStatus(), param.GetAddress())}, nil
} }
// QueryCountByStatusAndAddr query game count by status and addr // QueryCountByStatusAndAddr query game count by status and addr
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment