Skip to content
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

Remove gci linter because it breaks import comments #2184

Merged
merged 1 commit into from May 14, 2024

Conversation

alexandear
Copy link
Contributor

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Removes gci from the linter-settings golangci-lint's config because it's does nothing. This reverts #2069.

Special notes for your reviewer:

Adding gci to linters-settings has no effect. This can be checked by running golangci-lint in verbose mode (see "Active 14 linters"):

❯ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /Users/Oleksandr_Redko/src/github.com/kubernetes-sigs/kueue /Users/Oleksandr_Redko/src/github.com/kubernetes-sigs /Users/Oleksandr_Redko/src/github.com /Users/Oleksandr_Redko/src /Users/Oleksandr_Redko /Users /] 
INFO [config_reader] Used config file .golangci.yaml 
INFO [lintersdb] Active 14 linters: [copyloopvar dupword errcheck ginkgolinter gocritic goimports gosimple govet ineffassign loggercheck misspell staticcheck unconvert unused] 
INFO [loader] Go packages loading at mode 575 (compiled_files|exports_file|files|imports|name|deps|types_sizes) took 893.271667ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 28.035667ms 

To enable gci, it's needed to extend linters.enable list:

linters:
  enable:
    - ...
    - dupword
    - gci
    - ginkgolinter
    - ...

However, enabling gci can lead to some problems. gci removes the comments // +kubebuilder:scaffold:imports. This can be confirmed by running golangci-lint run --enable=gci --fix and observing the diff. Additionally, we already use goimports, which is also designed to sort imports.

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels May 10, 2024
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 10, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @alexandear. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 kubernetes-sigs/prow repository.

Copy link

netlify bot commented May 10, 2024

Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit ced804b
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-kueue/deploys/664217fecef5d60008de6468

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 10, 2024
@tenzen-y
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 13, 2024
@mimowo
Copy link
Contributor

mimowo commented May 14, 2024

I agree it does not make sense to keep the configuration for GCI if we are not enabling it.

However, I'm yet wondering about the pros and cons of GCI vs goimports. Maybe we could configure GCI so that there is no issue with removing // +kubebuilder:scaffold:imports?

@alexandear
Copy link
Contributor Author

alexandear commented May 14, 2024

@mimowo, you're absolutely correct about using gci instead of goimports. gci is more powerful.

Initially, I attempted to configure gci to prevent it from removing the comments. However, this was impossible. See the bug daixiang0/gci#135.

@mimowo
Copy link
Contributor

mimowo commented May 14, 2024

I see, in that case I'm ok to drop the config for now (as it makes the impression this is enabled).
We can return to re-enabling once the issue is fixed and the new version of gci is available.
/lgtm
/assign @tenzen-y

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 14, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 6bf4ba24817bf7ace15f1d4e06989c64ed08bec7

Copy link
Member

@tenzen-y tenzen-y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexandear Thank you for investigating the issue.
Could you dedicate an issue to keep track of GCI issues?

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexandear, tenzen-y

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 14, 2024
@k8s-ci-robot k8s-ci-robot merged commit ea587d9 into kubernetes-sigs:main May 14, 2024
15 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v0.7 milestone May 14, 2024
@alexandear alexandear deleted the revert-gci branch May 14, 2024 18:16
@alexandear
Copy link
Contributor Author

Could you dedicate an issue to keep track of GCI issues?

Created #2198

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants