-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
improve code quality #1064
improve code quality #1064
Conversation
default: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This results in different behavior, does it not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't change the observed behavior (it'll still block until either one of the first two cases return something).
TBH I don't really understand why the for loop is necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well if you have the default, you need the for, otherwise this is a one-and-done.
But it's still a terrible pattern, as it turns what could be a simple select into a hot loop?? Maybe an artifact from refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably, yeah. @withshubh could you please remove the for loop as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting for the fix to sd/etcd
Apparently the user deleted the fork. I resubmitted the PR in #1168 |
Unless you intend to fix the etcd issue too, I'd just close it. |
I fixed that too. |
Description
This PR fixes a few issues that were affecting the code quality.
Summary of changes
strings.Index
withstrings.Contains
bytes.Compare
withbytes.Equal