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

Reformat all imports using gci linter #2198

Open
alexandear opened this issue May 14, 2024 · 6 comments
Open

Reformat all imports using gci linter #2198

alexandear opened this issue May 14, 2024 · 6 comments
Labels
kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.

Comments

@alexandear
Copy link
Contributor

alexandear commented May 14, 2024

What would you like to be cleaned:

Reformat all imports using gci linter once the issue daixiang0/gci#135 is resolved.

Disable goimports because gci does the same work.

Why is this needed:

gci ensures consistency of the import order.

See discussions in #2069 and #2184.

@alexandear alexandear added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label May 14, 2024
@alexandear alexandear changed the title Enable gci linter and clean up lint import order issues Reformat all imports using gci linter May 14, 2024
@trasc
Copy link
Contributor

trasc commented May 14, 2024

Maybe I'm missing something, why do we need this gci ?

@alexandear
Copy link
Contributor Author

alexandear commented May 15, 2024

We need gci because it was introduced by PR #2069.

@alculquicondor
Copy link
Contributor

If the PR merged, doesn't it mean that we have no violations?

@alexandear
Copy link
Contributor Author

If the PR merged, doesn't it mean that we have no violations?

The PR #2069 didn't enable gci due to incorrect configuration, but the author and reviewers thought it was enabled. See the description in #2184 for a detailed explanation.

@alculquicondor
Copy link
Contributor

gotcha, so we can't re-enable gci just yet.

OTOH, we don't really use kube-builder scaffolding.

How reliable is this gci linter? The fact that it belongs to a person's github instead of an organization seems a bit worrisome.

@alexandear
Copy link
Contributor Author

gci has been included in golangci-lint since v1.30.0, so it's quite stable.

But let's ask the author of the original PR who wants to enable gci. @vladikkuzn, is it worth replacing goimports with gci?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.
Projects
None yet
Development

No branches or pull requests

3 participants