-
Notifications
You must be signed in to change notification settings - Fork 2.5k
improve code readability #3446
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 readability #3446
Conversation
Hey @cxljs, thanks for your contribution. |
Hello @ndyakov , the reason for reducing line breaks is that there will be a comma after the last parameter, which often makes me think there are more parameters on the next line. e.g.: func masterReplicaDialer(
failover *sentinelFailover,
) func(ctx context.Context, network, addr string) (net.Conn, error) { But this is just my personal opinion, if you think multiline function declaration is better for readibility, let's keep it as it is. |
I do have a preference, but I am not the only person working on this :) @htemelski-redis , @ofekshenawa feel free to share your opinions. |
I am a bit on the fence about the function definitions. func (c cmdable) GeoRadiusByMember(
ctx context.Context,
key, member string,
query *GeoRadiusQuery,
) *GeoLocationCmd { |
I also do like what @htemelski-redis is suggesting. |
3bfb847
to
eb8df22
Compare
I've reverted the function definitions to their original format. |
eb8df22
to
0be47f1
Compare
- replace two similar functions `appendUniqueNode` and `appendIfNotExists` with a generic function. - simplify the implementation of the `get` method in `clusterNodes` - keep the member name `_generation` of `clusterNodes` consistent with other types. - rename a data member `_masterAddr` to `masterAddr`. Signed-off-by: Xiaolong Chen <[email protected]>
0be47f1
to
a7fb1aa
Compare
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.
@cxljs Thank you for the contribution! This looks good.
replace two similar functions
appendUniqueNode
andappendIfNotExists
with a generic function.simplify the implementation of the
get
method inclusterNodes
.keep the member name
_generation
ofclusterNodes
consistent with other types.rename a data member
_masterAddr
tomasterAddr
.