From 802e2aaadd6f3cdcd803cf7c84d97ec92ea51646 Mon Sep 17 00:00:00 2001 From: caoming Date: Mon, 7 Jan 2019 10:27:52 +0800 Subject: [PATCH] etcdserver: remove redundant parentheses. --- etcdserver/api/v2store/event_history.go | 2 +- etcdserver/api/v2store/node.go | 4 ++-- etcdserver/api/v2store/watcher_hub.go | 2 +- etcdserver/api/v2v3/store.go | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/etcdserver/api/v2store/event_history.go b/etcdserver/api/v2store/event_history.go index 6bf7c0f5d..e4a969f37 100644 --- a/etcdserver/api/v2store/event_history.go +++ b/etcdserver/api/v2store/event_history.go @@ -79,7 +79,7 @@ func (eh *EventHistory) scan(key string, recursive bool, index uint64) (*Event, e := eh.Queue.Events[i] if !e.Refresh { - ok := (e.Node.Key == key) + ok := e.Node.Key == key if recursive { // add tailing slash diff --git a/etcdserver/api/v2store/node.go b/etcdserver/api/v2store/node.go index b51ecf0aa..38a6984fb 100644 --- a/etcdserver/api/v2store/node.go +++ b/etcdserver/api/v2store/node.go @@ -338,8 +338,8 @@ func (n *node) UpdateTTL(expireTime time.Time) { // Compare function compares node index and value with provided ones. // second result value explains result and equals to one of Compare.. constants func (n *node) Compare(prevValue string, prevIndex uint64) (ok bool, which int) { - indexMatch := (prevIndex == 0 || n.ModifiedIndex == prevIndex) - valueMatch := (prevValue == "" || n.Value == prevValue) + indexMatch := prevIndex == 0 || n.ModifiedIndex == prevIndex + valueMatch := prevValue == "" || n.Value == prevValue ok = valueMatch && indexMatch switch { case valueMatch && indexMatch: diff --git a/etcdserver/api/v2store/watcher_hub.go b/etcdserver/api/v2store/watcher_hub.go index 17652c2f3..a452e7e95 100644 --- a/etcdserver/api/v2store/watcher_hub.go +++ b/etcdserver/api/v2store/watcher_hub.go @@ -151,7 +151,7 @@ func (wh *watcherHub) notifyWatchers(e *Event, nodePath string, deleted bool) { w, _ := curr.Value.(*watcher) - originalPath := (e.Node.Key == nodePath) + originalPath := e.Node.Key == nodePath if (originalPath || !isHidden(nodePath, e.Node.Key)) && w.notify(e, originalPath, deleted) { if !w.stream { // do not remove the stream watcher // if we successfully notify a watcher diff --git a/etcdserver/api/v2v3/store.go b/etcdserver/api/v2v3/store.go index c7934d562..f1c7ab378 100644 --- a/etcdserver/api/v2v3/store.go +++ b/etcdserver/api/v2v3/store.go @@ -531,8 +531,8 @@ func compareFail(nodePath, prevValue string, prevIndex uint64, resp *clientv3.Tx return v2error.NewError(v2error.EcodeKeyNotFound, nodePath, mkV2Rev(resp.Header.Revision)) } kv := kvs[0] - indexMatch := (prevIndex == 0 || kv.ModRevision == int64(prevIndex)) - valueMatch := (prevValue == "" || string(kv.Value) == prevValue) + indexMatch := prevIndex == 0 || kv.ModRevision == int64(prevIndex) + valueMatch := prevValue == "" || string(kv.Value) == prevValue var cause string switch { case indexMatch && !valueMatch: