-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
*: sort-statement-order #28968
*: sort-statement-order #28968
Conversation
Signed-off-by: Mila Wu <wumila1996@gmail.com>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
@hawkingrei: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments. In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
LGTM |
In the uber golang style, there are two rules:
I think we should follow this rule. |
BTW, could you please finish the PR description to explain these changes a little bit? That would be nice for other reviewers to review. :) |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 9376f1d
|
Done. ;) |
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.
lgtm
I'm wondering do we have an official place that mentions that we should follow uber's go style? Otherwise there are multiple styles in the wild and it is not suitable to apply rules from different styles together. |
I second @breeswish and suspect that if we don't have a style checker, this change is meaningless and unmaintainable. It's totally OK to follow some codestyle we don't forbid when writing new code or refactor, but please prevent from do refactor for formatting without guard only - it causes noise. |
No. We've made a style guide on dev guide (later we simplify it) and the original context includes:
The simplify (and current) version is:
I think it means that, if the style is not documented and/or guarded by CI, it's unnecessary and suspicious to force to follow. |
IMO any uncontroversial and positive improvement to the code should be allowed to merge, regardless of whether it's a PR on its own or with other refactorings, or whether there are rules that specify the style of code we need to follow. |
Here is obviously controversies now.
It's suspicious. "Functions should be sorted in rough call order.", what is "rough"? To be clear, I totally agree with follow style you like and not forbidden when writing new code or non style-only refactor. If you like a style and want to apply in the codebase,
I'm afraid that we open the gate to random changes which is hardly proven to be good or converged. These changes increase the difficulty to do cherry-pick without non-trivial benefits.
They're good to follow when writing new code, and if you want to spread in the community, start a thread to add it to our style guide - but still, it will apply on new code in recommend without a checker. Also reject such style-only changes without checker or official rules to follow save our bandwidth. |
Signed-off-by: Mila Wu wumila1996@gmail.com
What problem does this PR solve?
Issue Number: close #xxx
Problem Summary:
In the uber golang style, there are two rules:
Functions should be sorted in rough call order.
Functions in a file should be grouped by receiver.
I think we should follow this rule.
What is changed and how it works?
Check List
Tests
Release note