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

Use golangci-lint for static checks #559

Merged
merged 3 commits into from
May 27, 2021
Merged

Use golangci-lint for static checks #559

merged 3 commits into from
May 27, 2021

Conversation

rolinh
Copy link
Member

@rolinh rolinh commented May 26, 2021

See commits for details. These changes are loosely based on the changes made to cilium-cli via #229.

Signed-off-by: Robin Hahling <robin.hahling@gw-computing.net>
The golint repository is unfortunately no longer maintained. The
golangci-lint project offers many static check tools that implement
checks that we had enabled via various tools.

Signed-off-by: Robin Hahling <robin.hahling@gw-computing.net>
All the static checks that were performed by these tools are covered by
golangci-lint with the given config (and more). Therefore, remove now
obsolete make targets and update the `check` target to run golangci-lint
instead. Note that as it is not recommended to instsall golangci-lint
via source, the target runs the binary when the expected version is
found and via a docker container otherwise.

Signed-off-by: Robin Hahling <robin.hahling@gw-computing.net>
@rolinh rolinh added kind/enhancement This would improve or streamline existing functionality. release-note/misc This PR makes changes that have no direct user impact. labels May 26, 2021

vet:
go vet $$(go list ./...)
ifneq (,$(findstring $(GOLANGCILINT_WANT_VERSION),$(GOLANGCILINT_VERSION)))
Copy link
Member

Choose a reason for hiding this comment

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

should we use some sort of semver comp here, i.e. 1.40.2 should be ok too, right? Or do we specifically want the exact match

Copy link
Member Author

@rolinh rolinh May 26, 2021

Choose a reason for hiding this comment

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

Sure, I can drop PATCH from the version check although that would make the code a bit more complicated.

Copy link
Member

@tklauser tklauser left a comment

Choose a reason for hiding this comment

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

Nice!

@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 May 27, 2021
@kaworu kaworu merged commit 1de9fb3 into master May 27, 2021
@kaworu kaworu deleted the pr/rolinh/golangci-lint branch May 27, 2021 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement This would improve or streamline existing functionality. 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.

4 participants