Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

etcdserver: remove redundant parentheses. #10375

Merged
merged 1 commit into from
Jan 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion etcdserver/api/v2store/event_history.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions etcdserver/api/v2store/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion etcdserver/api/v2store/watcher_hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions etcdserver/api/v2v3/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down