Parcourir la source

raft: remove misleading labels in array definition

Since these are arrays instead of maps, the "keys" here are actually
(useless) goto labels. What really matters is that the ordering is
the same between the constant declarations and the array.
Ben Darnell il y a 11 ans
Parent
commit
1083ce8f73
1 fichiers modifiés avec 12 ajouts et 12 suppressions
  1. 12 12
      raft/raft.go

+ 12 - 12
raft/raft.go

@@ -26,15 +26,15 @@ const (
 )
 
 var mtmap = [...]string{
-	msgHup:      "msgHup",
-	msgBeat:     "msgBeat",
-	msgProp:     "msgProp",
-	msgApp:      "msgApp",
-	msgAppResp:  "msgAppResp",
-	msgVote:     "msgVote",
-	msgVoteResp: "msgVoteResp",
-	msgSnap:     "msgSnap",
-	msgDenied:   "msgDenied",
+	"msgHup",
+	"msgBeat",
+	"msgProp",
+	"msgApp",
+	"msgAppResp",
+	"msgVote",
+	"msgVoteResp",
+	"msgSnap",
+	"msgDenied",
 }
 
 func (mt messageType) String() string {
@@ -54,9 +54,9 @@ const (
 type StateType int64
 
 var stmap = [...]string{
-	StateFollower:  "StateFollower",
-	StateCandidate: "StateCandidate",
-	StateLeader:    "StateLeader",
+	"StateFollower",
+	"StateCandidate",
+	"StateLeader",
 }
 
 func (st StateType) String() string {