Explorar el Código

Merge pull request #10562 from johncming/naked_return

contrib/raftexample: fix naked return.
Xiang Li hace 7 años
padre
commit
77d4b742cd
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      contrib/raftexample/raft.go

+ 1 - 1
contrib/raftexample/raft.go

@@ -126,7 +126,7 @@ func (rc *raftNode) saveSnap(snap raftpb.Snapshot) error {
 
 
 func (rc *raftNode) entriesToApply(ents []raftpb.Entry) (nents []raftpb.Entry) {
 func (rc *raftNode) entriesToApply(ents []raftpb.Entry) (nents []raftpb.Entry) {
 	if len(ents) == 0 {
 	if len(ents) == 0 {
-		return
+		return ents
 	}
 	}
 	firstIdx := ents[0].Index
 	firstIdx := ents[0].Index
 	if firstIdx > rc.appliedIndex+1 {
 	if firstIdx > rc.appliedIndex+1 {