Skip to content

chore(lint): migrate golangci-lint config to v2 and fix newly surfaced issues - #507

Draft
u-veles-a wants to merge 12 commits into
ppfrom
golangci_v2
Draft

u-veles-a wants to merge 12 commits into
ppfrom
golangci_v2

Conversation

@u-veles-a

Copy link
Copy Markdown
Collaborator

Description

Migrates .golangci.yml (root, pp/, pp-pkg/) from golangci-lint v1 to v2 config format, porting existing comments/rationale from the old configs into the new ones (pp/.golangci.yml.bak removed once ported). Fixes the lint findings that the v2 config and its updated linter set surface across the codebase — staticcheck, govet, gosec (including G115), and perfsprint — plus related test fixes, spanning pp/, pp-pkg/, cmd/, discovery/, model/, promql/, rules/, scrape/, storage/, tsdb/, web/, and other largely-unmodified upstream packages touched only for these lint fixes.

Why do we need it, and what problem does it solve?

The project's golangci-lint config was still on the v1 format; upgrading to v2 (and its stricter/updated linters) surfaced a number of real issues — nil-safety and error-handling gaps (staticcheck), suspicious Printf-style formatting/vet issues (govet), integer overflow/conversion risks (gosec G115), and inefficient string/number formatting (perfsprint). This PR brings the config current and clears the resulting backlog so CI lint gates pass on v2 going forward.

Additionally, starting with go1.27 golangci-lint v1 works very poorly (frequent crashes/incorrect analysis), so migrating to v2 is effectively required to keep linting usable with the toolchain version this repo is now on.

@u-veles-a u-veles-a added the enhancement New feature or request label Sep 16, 2026
@u-veles-a u-veles-a added this to the v0.9.0 milestone Sep 16, 2026
@u-veles-a
u-veles-a requested a review from vporoshok September 16, 2026 07:32
@u-veles-a u-veles-a self-assigned this Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant