From 3756fb23a6e36d28bad1d7560f614470214cb48b Mon Sep 17 00:00:00 2001 From: Sean Chittenden Date: Sun, 15 May 2016 06:40:46 -0700 Subject: [PATCH] Remove unused peers variable from setupRaft(). --- consul/server.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/consul/server.go b/consul/server.go index 865069f79..b022c26aa 100644 --- a/consul/server.go +++ b/consul/server.go @@ -350,7 +350,6 @@ func (s *Server) setupRaft() error { var log raft.LogStore var stable raft.StableStore var snap raft.SnapshotStore - var peers raft.PeerStore if s.config.DevMode { store := raft.NewInmemStore() @@ -358,8 +357,7 @@ func (s *Server) setupRaft() error { stable = store log = store snap = raft.NewDiscardSnapshotStore() - peers = &raft.StaticPeers{} - s.raftPeers = peers + s.raftPeers = &raft.StaticPeers{} } else { // Create the base raft path path := filepath.Join(s.config.DataDir, raftState) @@ -393,20 +391,19 @@ func (s *Server) setupRaft() error { // Setup the peer store s.raftPeers = raft.NewJSONPeers(path, trans) - peers = s.raftPeers } // Ensure local host is always included if we are in bootstrap mode if s.config.Bootstrap { - peers, err := s.raftPeers.Peers() + peerAddrs, err := s.raftPeers.Peers() if err != nil { if s.raftStore != nil { s.raftStore.Close() } return err } - if !raft.PeerContained(peers, trans.LocalAddr()) { - s.raftPeers.SetPeers(raft.AddUniquePeer(peers, trans.LocalAddr())) + if !raft.PeerContained(peerAddrs, trans.LocalAddr()) { + s.raftPeers.SetPeers(raft.AddUniquePeer(peerAddrs, trans.LocalAddr())) } }