-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
✨ Enforce go import order via gci linter #5592
✨ Enforce go import order via gci linter #5592
Conversation
/cc @stmcginnis (next try :)) |
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
+/- a question on kubebuilder tags - are they just artefacts from the creation process?
Thanks for this! Definitely going to be a big help on PRs 😄 |
4f25fb1
to
5fd8ecf
Compare
.golangci.yml
Outdated
gci: | ||
local-prefixes: sigs.k8s.io/cluster-api |
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.
Can we use no local prefixes? Most folks out there with goimports won't necessarily make use of it and we can reduce some friction here
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.
Done
5fd8ecf
to
32cee53
Compare
Signed-off-by: Stefan Büringer buringerst@vmware.com
32cee53
to
ec1fa65
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.
/approve
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vincepri 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 |
Signed-off-by: Stefan Büringer buringerst@vmware.com
What this PR does / why we need it:
The GCI linter is essentially an improved (imho) version of goimports, which is also compatible with goimports, i.e. gci results in an import format which is compatible to what goimports enforces. (just a bit more strict)
With the configuration in this PR it sorts the imports in this order: (we could merge the second and third block if we want)
I think this would help reviewers and contributors by just enforcing the right import order this way. gci supports
make lint-fix
so nobody has to sort the imports manually after e.g. Intellij added them arbitrarily.The current situation where we are not linting it automatically but manually on PRs does not seem like an ideal situation and requires additional effort from reviewers and contributors.
P.S. The changes in this PR are a result of the changes in the golang-ci config + running
make lint-fix
.xref: #5585 (comment)
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #