chore(ci): Migrate Golangci-lint config from v1 to v2. Update Go version to 1.24.#14
chore(ci): Migrate Golangci-lint config from v1 to v2. Update Go version to 1.24.#14davemarco merged 8 commits intoy-scope:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
jackluo923
left a comment
There was a problem hiding this comment.
Code Review
🟡 Medium Issues
1. Path exclusions reference non-existent directories
paths:
- third_party$
- builtin$
- examples$None of these directories exist on main:
- No
third_partyorthird-partydirectory - No
builtindirectory - No
examplesdirectory
These exclusions are harmless but suggest the config was copied from another project without adaptation. Consider removing them to avoid confusion, or add a comment explaining they're for future use.
2. stylecheck linter was silently dropped
The original config had stylecheck enabled with specific checks:
# Original (v1)
- "stylecheck"
stylecheck:
checks:
- "all"
- "-ST1020" # ...etcThe migrated config removes it entirely. The -ST1020, -ST1021, -ST1022, -ST1023 exclusions were moved to staticcheck, but stylecheck does more than just ST checks.
Was this intentional? If so, please mention it in the PR description.
🟢 Looks Good
| Item | Status |
|---|---|
| Action versions (checkout@v6, setup-go@v6, golangci-lint-action@v9) | ✅ Valid and current |
| Go version 1.25.6 | ✅ Good |
| golangci-lint v2 config structure | ✅ Correct |
| Exclusion presets | ✅ Good additions |
goimports with local-prefixes |
✅ Correctly migrated |
| README install command | ✅ Updated correctly |
There was a problem hiding this comment.
Additional Suggestion: More Comprehensive Linting
Consider adopting the more comprehensive linting configuration from the irv2-beta branch. You can reference the config here:
Additional Linters (from irv2-beta)
| Linter | Purpose |
|---|---|
errorlint |
Checks for errors that aren't wrapped properly with %w |
exhaustive |
Ensures switch statements on enums are exhaustive |
gosec |
Security-focused linter (detects hardcoded credentials, SQL injection, etc.) |
misspell |
Catches common spelling mistakes in comments and strings |
nilnil |
Detects returning both nil error and nil value |
recvcheck |
Checks for receiver type consistency |
Better Formatters (from irv2-beta)
| Formatter | Purpose |
|---|---|
gci |
More configurable import ordering than goimports |
gofumpt |
Stricter gofmt with additional rules |
golines |
Automatically wraps long lines (respects 100 char limit) |
Task-Based Linting Approach
The irv2-beta branch uses a task-based approach that allows running linters locally with the same configuration as CI:
# Run all linting checks (Go + YAML)
task lint:check
# Auto-fix formatting issues
task lint:fixBenefits:
- Local/CI parity: Same linting rules run locally and in CI
- YAML linting: Includes
yamllintfor YAML files (not just Go) - Auto-install: Task automatically downloads golangci-lint and sets up Python venv for yamllint
- Reproducible: Pinned tool versions ensure consistent results across developers
See CONTRIBUTING.md on irv2-beta for setup instructions.
This is optional but would improve the developer experience and catch more issues early.
the migration script added these, but i removed them and there are no issues
according to migration docs, this was merged into static check
@davidlion set up initial linting config, maybe u 2 can discuss to see if u think more linters are needed. If so i can do in another PR, and fix any linter errors in existing code.
This is good idea, but i think can be done in another pr. u can still lint locally with golangci-lint run |
davidlion
left a comment
There was a problem hiding this comment.
The code lgtm. Let's update the title to follow our guidelines and change the description to complete sentences.
|
updated title and description @davidlion |
Description
Golangci-lint introduced a new configuration format, so this PR migrates the config from v1 to v2 using the official migrate tool.
It also updates outdated versions for GitHub Actions, golangci-lint and Go.
No functional code changes are included.
Checklist
breaking change.
Validation performed
Ran
golangci-lint runwith no errors.