-
Notifications
You must be signed in to change notification settings - Fork 16
Simplify GCI golangci-lint config with localmodule #468
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
Conversation
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.
Pull Request Overview
This PR simplifies the golangci-lint configuration generation by removing the template substitution mechanism and adopting gci's built-in localmodule section instead of a dynamically generated prefix() section.
Key changes:
- Removed the
yqsubstitution step that replaced{{REPO-NAME}}placeholder with the actual repository name - Replaced the custom
prefix({{REPO-NAME}})section with the standardizedlocalmodulesection in the gci formatter configuration
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| modules/go/01_mod.mk | Removed the yq command that performed template substitution for REPO-NAME placeholder |
| modules/go/.golangci.override.yaml | Replaced custom prefix-based import grouping with the built-in localmodule section |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Erik Godding Boye <[email protected]>
6199b6f to
a732d53
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.
Pull Request Overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: inteon 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 |
|
@erikgb this results in a LARGE diff in the cert-manager/cert-manager repo. |
Ok, that's unfortunate. According to my testing, this should not be the case. Let me take a look. |
I notice a diff, but only one diff in the main module of cert-manager, where Should we revert this, @inteon? I would prefer keeping it, but I am also OK with a revert. |
|
This was discussed in today's stand-up, where @SgtCoDFish, @ThatsMrTalbot, and @mladen-rusev-cyberark were present. I want to know if we should roll forward or roll back this? Changing the import order to avoid the "templating" of the golangci-lint config is a one-time change, which can now be automated with the improved We discussed this a bit, and none raised concern with a one-time change of the imports order/grouping. I will create a PR to "manually self-upgrade" in cert-manager. If this PR is approved and merged, we will move forward with this change. If not, I will ensure that we revert this change. CC: @inteon |
Great @erikgb, I would like to look at the cert-manager changes in more detail. |
This is a (slightly modified) cherry-pick of #312, which was later reverted in #328. The missing piece was setting the
custom-ordersetting totrue, ref. https://golangci-lint.run/docs/formatters/configuration/#gci.I have tested this again with golangci-lint 2.6.0, and it works now. And it seems like the
golangci-lint run --fixproposed in #467 requires us to uselocalmoduleinstead ofprefixto do the right thing.