-
Notifications
You must be signed in to change notification settings - Fork 94
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
🌱 add a verify rule for golang files import order #177
🌱 add a verify rule for golang files import order #177
Conversation
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## main #177 +/- ##
=======================================
Coverage 58.36% 58.36%
=======================================
Files 109 109
Lines 11713 11713
=======================================
Hits 6836 6836
Misses 4212 4212
Partials 665 665
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
Maybe we can import this indirectly by depending on golangci-lint https://golangci-lint.run/usage/linters/#gci, it's like a more commonly used linter tool integrated with more features including Also, the developers may have different fmt tools on their laptops, if we want to add a verification step to the workflow, it would become a potential standard and they may need to configure their editors to use the same tool to fmt go files. |
Thanks @xuezhaojun yes, I have considered using golangci-lint, but once enable the lint check, there are so many errors that need to fix, which makes the PR hard to review, so I will add the lint check in another PR. |
else \ | ||
echo "Diff output is empty"; \ | ||
fi | ||
|
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 could be put under verify target, so you do not need create another action step
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.
after this PR is merged, I will integrate the verification into golangci-lint: https://golangci-lint.run/usage/linters/#gci by a follow up PR
/hold |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: qiujian16, zhujian7 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This PR uses the [gci tool](https://github.com/daixiang0/gci) to make all go files' import section with a specific order, it will organize import with group with order: 1. standard library modules 2. 3rd party modules 3. modules in OCM org, like the `open-cluster-management.io/api` 4. current project `open-cluster-management.io/ocm` modules developers can use the `make fmt-imports` to format the import automatically and the `make verify-fmt-imports` to check for any violation. Signed-off-by: zhujian <jiazhu@redhat.com>
Signed-off-by: zhujian <jiazhu@redhat.com>
/lgtm |
/unhold |
…nt-io#177) Signed-off-by: melserngawy <melserng@redhat.com>
Summary
This PR uses the gci tool to make all go files' import section with a specific order, it will organize import with group with order:
open-cluster-management.io/api
open-cluster-management.io/ocm
modulesdevelopers can use the
make fmt-imports
to format the import automatically and themake verify-fmt-imports
to check for any violation.Related issue(s)
Fixes #