mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
*: fix a few small issues identified by go vet
This commit is contained in:
parent
55b4267c30
commit
9997c9488a
@ -68,7 +68,7 @@ func (ps *Peers) String() string {
|
||||
|
||||
func (ps Peers) Ids() []int64 {
|
||||
var ids []int64
|
||||
for id, _ := range ps {
|
||||
for id := range ps {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
return ids
|
||||
|
@ -168,7 +168,12 @@ func (l *raftLog) compact(i int64) int64 {
|
||||
}
|
||||
|
||||
func (l *raftLog) snap(d []byte, index, term int64, nodes []int64) {
|
||||
l.snapshot = pb.Snapshot{d, nodes, index, term, nil}
|
||||
l.snapshot = pb.Snapshot{
|
||||
Data: d,
|
||||
Nodes: nodes,
|
||||
Index: index,
|
||||
Term: term,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *raftLog) shouldCompact() bool {
|
||||
|
@ -518,14 +518,14 @@ func TestHandleMsgApp(t *testing.T) {
|
||||
}
|
||||
m := sm.ReadMessages()
|
||||
if len(m) != 1 {
|
||||
t.Errorf("#%d: msg = nil, want 1")
|
||||
t.Errorf("#%d: msg = nil, want 1", i)
|
||||
}
|
||||
gaccept := true
|
||||
if m[0].Index == -1 {
|
||||
gaccept = false
|
||||
}
|
||||
if gaccept != tt.wAccept {
|
||||
t.Errorf("#%d: accept = %v, want %v", gaccept, tt.wAccept)
|
||||
t.Errorf("#%d: accept = %v, want %v", i, gaccept, tt.wAccept)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -764,7 +764,7 @@ func TestRecvMsgBeat(t *testing.T) {
|
||||
}
|
||||
for _, m := range msgs {
|
||||
if m.Type != msgApp {
|
||||
t.Errorf("%d: msg.type = %v, want %v", m.Type, msgApp)
|
||||
t.Errorf("%d: msg.type = %v, want %v", i, m.Type, msgApp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ func TestRecoverAfterCut(t *testing.T) {
|
||||
continue
|
||||
}
|
||||
if id != info.Id {
|
||||
t.Errorf("#%d: id = %d, want %d", id, info.Id)
|
||||
t.Errorf("#%d: id = %d, want %d", i, id, info.Id)
|
||||
}
|
||||
for j, e := range entries {
|
||||
if e.Index != int64(j+i+1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user