Skip to content

PMM-7 Migrate golangci-lint to v2#1221

Open
ademidoff wants to merge 2 commits into
mainfrom
PMM-7-migrate-to-golangci-v2
Open

PMM-7 Migrate golangci-lint to v2#1221
ademidoff wants to merge 2 commits into
mainfrom
PMM-7-migrate-to-golangci-v2

Conversation

@ademidoff
Copy link
Copy Markdown
Member

@ademidoff ademidoff commented May 20, 2026

This pull request upgrades the project to use golangci-lint v2 and updates the linter configuration to the new version's format. The workflow for running linters in CI is adjusted for the new linter output format.

Upgrade to golangci-lint v2 and configuration changes:

  • Upgraded from golangci-lint v1.x to golangci-lint/v2 v2.12.2.
  • Migrated .golangci.yml to the new v2 configuration format.

CI workflow update:

  • Updated the CI workflow to use the new golangci-lint v2 output flags (--output.text.path=stdout, etc.), ensuring compatibility with reviewdog.

@ademidoff ademidoff marked this pull request as ready for review May 20, 2026 23:56
@ademidoff ademidoff requested a review from a team as a code owner May 20, 2026 23:56
@ademidoff ademidoff requested review from 4nte and JiriCtvrtka May 20, 2026 23:56
Comment thread .github/workflows/ci.yml
run: |
# use GITHUB_TOKEN because only it has access to GitHub Checks API
bin/golangci-lint run --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -reporter=github-pr-review -filter-mode=added -fail-level=error
bin/golangci-lint run --output.text.path=stdout --output.text.print-issued-lines=false --output.text.colors=false | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -reporter=github-pr-review -filter-mode=added -fail-level=error
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why not to switch to unified approach that we use:

     -  name: Run code linters
        uses: reviewdog/action-golangci-lint@c76cceaaab89abe74e649d2e34c6c9adc26662d2 # v2.10.0
        with:
          github_token: ${{ secrets.ROBOT_TOKEN || secrets.GITHUB_TOKEN }}
          go_version_file: ${{ github.workspace }}/go.mod
          reporter: github-pr-review
          fail_level: error
          cache: false
          golangci_lint_flags: "-c=.golangci.yml"
          golangci_lint_version: v2.12.2 # Version should match specified in Makefile

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.

2 participants