-
Notifications
You must be signed in to change notification settings - Fork 124
Updated .golangci.yml from v1 to v2 #727
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
Signed-off-by: fyzanshaik <[email protected]>
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.
Hello @fyzanshaik, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request updates the .golangci.yml
configuration file from v1 to v2 format. The previous configuration was outdated and caused golangci-lint run
to fail. The configuration was manually migrated to the v2 format based on the official documentation, since automatic migration attempts failed. The PR removes the golint
, scopelint
, and go-mod-tidy
linters, as they are no longer supported. The updated configuration now loads successfully and runs the analysis.
Highlights
- Configuration Update: The
.golangci.yml
file has been updated from v1 to v2 format to resolve configuration loading errors. - Linter Changes: The
golint
,scopelint
, andgo-mod-tidy
linters have been removed due to incompatibility with the currentgolangci-lint
version. - Manual Migration: The configuration was manually migrated to v2 format, as automatic migration attempts were unsuccessful.
- Exclusion Rules: Exclusion rules are now handled under
linters.exclusions
and require at least two matching criteria in v2.
Changelog
Click here to see the changelog
- .golangci.bck.yml
- This file is a backup of the original .golangci.yml file before the changes were applied.
- .golangci.yml
- Updated the configuration file to v2 format.
- Removed the
linters-settings
section; linter settings are now underlinters.settings
. - Added a new
formatters
section;gci
and its settings are moved there. - Handled exclusions (
exclude-dirs
,exclude-rules
) underlinters.exclusions
. - Replaced
linters.enable-all
andlinters.disable-all
withlinters.default: none
. - Removed the
run.timeout
option. - Removed the
golint
,scopelint
, andgo-mod-tidy
linters. - Added
find-duplicates: true
to goconst settings. - Updated cyclop average strictness to 12.
- Added more paths to exclusions.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Old configs cause much pain,
New versions bring back the gain.
Linting rules align,
Code quality will shine,
Errors vanish, all is sane.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
The pull request updates the .golangci.yml
configuration file to the v2 format. The migration seems to be done correctly, referring to the documentation for golangci-lint. The key changes in the new config (v2 vs Old) are well documented in the PR description. Overall, the changes look good, but I have a few suggestions for improvement.
Summary of Findings
- Linter Configuration: The PR updates the
.golangci.yml
configuration file to the v2 format, addressing the issue of using an outdated configuration. This includes migrating settings, formatters, and exclusions to the new format. The removal of unsupported linters (golint
,scopelint
, andgo-mod-tidy
) is also noted. - Exclusion Rules: The exclusion rules in the v2 configuration require at least two matching criteria (e.g.,
text
andpath
). The configuration now includes exclusion rules fortestpackage
based on both text and path. - Cyclop Configuration: The cyclop linter's
average-strictness
has been increased from 7 to 12. This might lead to more strictness checks, and the author should verify that this doesn't cause unexpected issues.
Merge Readiness
The code changes seem to be well-done, and the PR description is very detailed. I would recommend addressing the suggestions before merging. I am unable to directly approve this pull request, and recommend that others review and approve this code before merging.
Hey @fyzanshaik , If all these are fine then these lint checks would pass and you won't see any crosses under your PR. Hope this helps. Please go ahead and make sure the above mention problems are not the issue. Then we can review this PR. |
@Jougan-0 Thanks for the review! The code isn't faulty and all errors are being handled properly. Based on the CI There's an existing PR addressing this issue for the specific version 694 which addresses the same points and changes I have mentioned in this PR. I have overlooked upon golangci version the existing PR (694) should be the one we should merge, whereas my PR followed the guidelines for version golangci-lint 2.0.2 which isn't needed by the CI. |
PR abandoned. |
Description
This PR fixes #710
Why?
Old config (v1) is unsupported, causing
golangci-lint run
to fail.How?
Manual migration to v2, as auto-migration failed. Followed official docs.
Key Changes:
linters.settings
formatters
section forgci
linters.exclusions
(need 2+ criteria)linters.default: none
replacesenable-all
/disable-all
run.timeout
(ignored in v2)Removed:
golint
,scopelint
,go-mod-tidy
(no longer supported)Outcome:
golangci-lint run
now works with the new config.References:
Signed commits