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

Include golangci-lint in fmt Make target #1672

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shuheiktgw
Copy link

@shuheiktgw shuheiktgw commented Feb 8, 2025

What does this PR do?

Currently, there's no easy way to run golangci-lint run ./... --fix for formatting. It would be more convenient and intuitive if we could execute it via the fmt Make target.

Thanks for your review!

Motivation

Running golangci-lint run ./... --fix easier.

Checklist

  • PR has at least one valid label: bug, enhancement, refactoring, documentation, tooling, and/or dependencies
  • PR has a milestone or the qa/skip-qa label

@shuheiktgw shuheiktgw requested a review from a team as a code owner February 8, 2025 16:51
@@ -306,7 +307,7 @@ patch-crds: bin/$(PLATFORM)/yq ## Patch-crds
hack/patch-crds.sh

.PHONY: lint
lint: bin/$(PLATFORM)/golangci-lint fmt vet ## Lint
Copy link
Author

Choose a reason for hiding this comment

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

I believe we should not include the fmt target in the lint target. Consider the following two cases:

  1. A user makes local commits and runs the lint target for a final check. Even if there are lint failures, the fmt target fixes them automatically, causing the lint target to succeed despite local diffs. As a result, the user may push the commit without realizing there are uncommitted changes.
  2. In CI, make lint runs, and even if there are lint failures, the fmt target fixes them. This could cause the CI job to pass mistakenly, despite the issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant