From 1b41ee9c99e8174a77548ebc599fea58172d497c Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Thu, 7 Apr 2016 22:14:56 -0700 Subject: [PATCH] raft: fix issues reported by golint --- raft/raft.go | 4 +--- raft/storage.go | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/raft/raft.go b/raft/raft.go index e7da600b7..a39bbae79 100644 --- a/raft/raft.go +++ b/raft/raft.go @@ -29,8 +29,6 @@ import ( const None uint64 = 0 const noLimit = math.MaxUint64 -var ErrSnapshotTemporarilyUnavailable = errors.New("snapshot is temporarily unavailable") - // Possible values for StateType. const ( StateFollower StateType = iota @@ -229,7 +227,7 @@ func newRaft(c *Config) *raft { } r.becomeFollower(r.Term, None) - nodesStrs := make([]string, 0) + var nodesStrs []string for _, n := range r.nodes() { nodesStrs = append(nodesStrs, fmt.Sprintf("%x", n)) } diff --git a/raft/storage.go b/raft/storage.go index f3724162c..78d192556 100644 --- a/raft/storage.go +++ b/raft/storage.go @@ -29,8 +29,14 @@ var ErrCompacted = errors.New("requested index is unavailable due to compaction" // index is older than the existing snapshot. var ErrSnapOutOfDate = errors.New("requested index is older than the existing snapshot") +// ErrUnavailable is returned by Storage interface when the requested log entries +// are unavailable. var ErrUnavailable = errors.New("requested entry at index is unavailable") +// ErrSnapshotTemporarilyUnavailable is returned by the Storage interface when the required +// snapshot is temporarily unavailable. +var ErrSnapshotTemporarilyUnavailable = errors.New("snapshot is temporarily unavailable") + // Storage is an interface that may be implemented by the application // to retrieve log entries from storage. //