pipecd icon indicating copy to clipboard operation
pipecd copied to clipboard

Make local golang-lint as same as on the CI

Open khanhtc1202 opened this issue 9 months ago • 6 comments

What would you like to be added:

Make local golang lint check as same as on the CI

Why is this needed:

khanhtc1202 avatar Mar 21 '25 08:03 khanhtc1202

Hello!

It seems that both local and CI are running the same golangci-lint version (v1.64.7) . In CI, reviewdog is used, while docker is used locally.

What exactly does "making local and CI the same" refer to?

Thanks!

Okabe-Junya avatar Apr 28 '25 17:04 Okabe-Junya

FWIW: Another golangci-lint task is migrating golangci-lint v2

FYI: https://ldez.github.io/blog/2025/03/23/golangci-lint-v2/

Okabe-Junya avatar Apr 28 '25 17:04 Okabe-Junya

So based on @Okabe-Junya 's comment and as per the codebase

I'm looking at making the local golang lint check match what's running in CI.

Am I understanding correctly that the task is to ensure local linting matches the CI environment? If so, I'm thinking of updating the Makefile's lint/go target to ensure it uses the exact same linting rules and Go version.

Is this the right approach, or is there something specific about the CI setup I should be aware of?

Thanksss!!!! @khanhtc1202

abhinavs1920 avatar May 11 '25 19:05 abhinavs1920

@khanhtc1202 @t-kikuc i would like work on this

Tushar240503 avatar May 22 '25 19:05 Tushar240503

Sorry for the late reply and insufficient information.

We use the reviewdog on our CI, so the lint job fails only when the linter warnings/errors are detected on the changed lines in that PR. Conversely, we use golangci-lint on our local execution without the new option. Because of these, results are inconsistent between local and CI. Even if some warnings/errors are detected on our local execution result, that doesn't mean the CI will fail.

We have two options to resolve this issue. One is a way to make the CI stricter. I.E., make the result a failure even if the warnings/errors are out of diffs. The other way is to loosen the local result. I.E., make the result successful if the warnings/errors are out of diffs.

@t-kikuc @ffjlabo @khanhtc1202 (as a maintainer) @Okabe-Junya @abhinavs1920 @Tushar240503 (as interested in this issue) We have no consensus yet on which to choose, so I want to hear others' opinions. IMO, the latter way, to loosen the local result, is the way to go easy because we can fix the CI by taking care of only the diff in the PR.

Warashi avatar May 23 '25 04:05 Warashi

@Warashi I think we should go ahead with the second option right away — align local linting with CI by focusing only on diffs. This will provide immediate consistency for developers and reduce friction.

At the same time, we can start planning and working toward making CI stricter as a long-term goal. This way, we’re not blocked by existing warnings, but we’re still improving the overall code quality step by step.

Tushar240503 avatar May 24 '25 08:05 Tushar240503