Migrate golangci-lint config to v2 and add new linters#272
Merged
orestisfl merged 6 commits intoelastic:mainfrom Dec 11, 2025
Merged
Migrate golangci-lint config to v2 and add new linters#272orestisfl merged 6 commits intoelastic:mainfrom
orestisfl merged 6 commits intoelastic:mainfrom
Conversation
Migrate .golangci.yml to v2 format: - Update configuration schema to version 2 - Move goimports to formatters section - Preserve all linter descriptions as comments Fix linter issues: - Replace exec.Command with exec.CommandContext (noctx) - Update deprecated nolint directives (deadcode/structcheck -> unused) - Fix bug in util.go: sc.Err() check was wrapping wrong error variable (caught by nilnesserr linter) Add new linters: - containedctx: detects struct contained context.Context field - contextcheck: checks whether function uses non-inherited context - exptostd: detects golang.org/x/exp functions replaceable by std - nilnesserr: reports err != nil checks returning different nil error - prealloc: finds slice declarations that could be pre-allocated - predeclared: finds code shadowing Go's predeclared identifiers - usetesting: detects uses replaceable by standard testing helpers Auto-fixed issues from golangci-lint --fix across multiple files.
Fix unused field warnings on Windows: - Move IOStat struct to platform-specific files - Linux version includes lastCPU/curCPU fields for iostat calculations - Windows/Darwin/FreeBSD versions only have lastDiskIOCounters Fix usetesting warnings: - Replace context.Background() with t.Context() in test functions
andrzej-stencel
previously approved these changes
Dec 10, 2025
andrzej-stencel
approved these changes
Dec 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Migrate .golangci.yml to v2 format:
Fix linter issues:
Add new linters:
Auto-fixed issues from golangci-lint --fix across multiple files.
Why is it important?
bug fix, catch future bugs, developer productivity
Checklist
I have added an entry inCHANGELOG.md