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

Introducing stylecheck linter to detect duplicate package imports in Go code #30215

Merged
merged 2 commits into from
Jan 31, 2024

Conversation

nickolaev
Copy link
Contributor

@nickolaev nickolaev commented Jan 11, 2024

We introduce stylecheck linter in .golangci.yaml, but enable it only for duplicate imports (ST1019)

Then this PR fixes all the duplicate go imports found by running:

make golangci-lint

This is a re-spin of the original (abandoned) #28062 by @Archisman-Mridha

Fixes: #27676

@nickolaev nickolaev requested review from a team as code owners January 11, 2024 16:44
@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Jan 11, 2024
@nickolaev nickolaev force-pushed the pr/nickolaev/staticcheck_linter branch from af328d0 to 566936c Compare January 11, 2024 16:49
.github/workflows/lint-go.yaml Outdated Show resolved Hide resolved
.github/workflows/lint-go.yaml Outdated Show resolved Hide resolved
@nickolaev nickolaev force-pushed the pr/nickolaev/staticcheck_linter branch from 566936c to fca0de1 Compare January 12, 2024 11:58
@nickolaev nickolaev requested a review from brlbil January 12, 2024 11:58
@youngnick youngnick removed their request for review January 15, 2024 04:52
Copy link
Member

@pippolo84 pippolo84 left a comment

Choose a reason for hiding this comment

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

Thanks! 💯

Copy link
Member

@kaworu kaworu left a comment

Choose a reason for hiding this comment

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

Hubble patch LGTM, however I have a golangci-lint / staticcheck GHA question (see below).

.github/workflows/lint-go.yaml Outdated Show resolved Hide resolved
@kaworu kaworu added area/CI Continuous Integration testing issue or flake kind/cleanup This includes no functional changes. release-note/misc This PR makes changes that have no direct user impact. labels Jan 15, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Jan 15, 2024
@nickolaev nickolaev force-pushed the pr/nickolaev/staticcheck_linter branch from fca0de1 to 1f43afd Compare January 15, 2024 15:22
@nickolaev nickolaev changed the title Introducing staticcheck linter to detect duplicate package imports in Go code. Introducing stylecheck linter to detect duplicate package imports in Go code Jan 15, 2024
@nickolaev nickolaev force-pushed the pr/nickolaev/staticcheck_linter branch from 1f43afd to e784222 Compare January 15, 2024 16:41
Copy link
Member

@mhofstetter mhofstetter left a comment

Choose a reason for hiding this comment

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

LGTM. thanks for switching to golangci-lint. 🎉

@nickolaev nickolaev force-pushed the pr/nickolaev/staticcheck_linter branch from e784222 to 8c8651f Compare January 16, 2024 05:27
Copy link
Member

@kaworu kaworu left a comment

Choose a reason for hiding this comment

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

Thank you!

@kaworu
Copy link
Member

kaworu commented Jan 16, 2024

/test

@nickolaev nickolaev force-pushed the pr/nickolaev/staticcheck_linter branch from 8c8651f to b8a2974 Compare January 16, 2024 12:48
@nickolaev nickolaev force-pushed the pr/nickolaev/staticcheck_linter branch from b8a2974 to ac2c269 Compare January 27, 2024 01:37
This will be invoked as part of the CI workflow linting.

Signed-off-by: Nikolay Nikolaev <[email protected]>
After adding stylecheck in the previous commit, we do fix all the issues
it found.

The used command was:
make golangci-lint

Signed-off-by: Archisman Mridha <[email protected]>
Signed-off-by: Nikolay Nikolaev <[email protected]>

# Conflicts:
#	pkg/k8s/watchers/watcher.go
#	pkg/service/service.go
@nickolaev nickolaev force-pushed the pr/nickolaev/staticcheck_linter branch from ac2c269 to 6d40d3a Compare January 31, 2024 10:34
@mhofstetter mhofstetter removed the request for review from ldelossa January 31, 2024 10:36
@mhofstetter
Copy link
Member

/test

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Jan 31, 2024
@julianwiedmann julianwiedmann added this pull request to the merge queue Jan 31, 2024
Merged via the queue into cilium:main with commit 6613935 Jan 31, 2024
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/CI Continuous Integration testing issue or flake kind/cleanup This includes no functional changes. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a linter for packages is being imported more than once (ST1019)