Go Module Review: golangci-lint #7356
Closed
Replies: 2 comments 1 reply
|
/plan |
1 reply
Plan Created ✅I've created a comprehensive plan to upgrade golangci-lint from v1.62.2 to v2.7.2. This will close the 8-month version gap and unlock 100+ improvements, Go 1.25 support, and new linters. Tracking IssueA parent tracking issue has been created with 5 focused sub-tasks:
Migration StrategyThe upgrade uses golangci-lint's automated migration tool to handle breaking changes safely. Each task builds on the previous one to ensure a safe, incremental upgrade path. Expected Benefits
The plan is ready for execution. SWE agents can now work through the tasks sequentially.
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
🐹 Go Fan Report: golangci-lint
Module Overview
golangci-lint is the industry-standard fast linters runner for Go. It runs linters in parallel, uses caching, supports YAML configuration, integrates with all major IDEs, and includes over a hundred linters. It's the most popular Go linting tool with 18,194+ GitHub stars.
🚨 Critical Finding: Major Version Gap
Current Version: v1.62.2
Latest Version: v2.7.2 (released Dec 7, 2025 - just 16 days ago!)
Version Gap: 8 months of development with a MAJOR version upgrade
Why This Matters
Current Usage in gh-aw
Build Dependency Management ✅
tools.go:9- Uses Go tools pattern properly_ "github.com/golangci/golangci-lint/cmd/golangci-lint"Makefile Integration ✅
make golint(Makefile:305-312)golangci-lint runConfiguration ✅ (but v1 format)
.golangci.yml(59 lines)errcheck- Check for unchecked errorsgofmt- Check formattinggoimports- Check importsrevive- Fast, extensible, flexible lintergovet- Official Go static analyzerineffassign- Detect ineffectual assignmentsmisspell- Find commonly misspelled English wordsstaticcheck- Advanced static analysistypecheck- Type checkingunused- Check for unused codeSmart Exclusions ✅
_test.gofilesCI Integration ✅
.github/workflows/ci.yml:418-419Research Findings
Repository Status 🌟
v2.0.0 Major Release Highlights (March 24, 2025)
🚨 BREAKING CHANGES - But migration is automated!
golangci-lint fmtCommand: Unified formatting toolgolangci-lint migrateCommand: Automated v1 → v2 migrationstaticcheck+stylecheck+gosimple→ one linter--fast-onlyFlag: Skip slow linters for faster feedbacklinters.exclusions.warn-unusedoptionv2.1.0 - v2.7.2 Incremental Improvements
modernizeanalyzer suitemodernizelinter for modern Go patternsNew Linters in v2
modernize- Analyzer suite for modern Go patternsgodoclint- Documentation lintingunqueryvet- SQL query validationiotamixing- Iota usage patternsfuncorder- Function orderingarangolint,embeddedstructfieldcheck,noinlineerr- Specialized checksImprovement Opportunities
🔥 HIGH PRIORITY
1. Upgrade to v2.7.2
Why: 8 months of improvements, Go 1.25 support, 100+ new features
Migration Steps:
Risk: MODERATE - v2 has breaking changes, but
golangci-lint migrateautomates conversion2. Enable Additional v2 Linters
Current: 11 linters
Opportunity: 100+ linters available in v2
Recommended Additions:
Why: These linters catch common issues without being overly noisy
3. Enable Configuration Hygiene
Opportunity: v2 warns about unused exclusion rules
Benefits: Clean configuration, easier maintenance
⭐ MEDIUM PRIORITY
4. Add
--new-from-revfor CI PerformanceCurrent: Full repository scan (~3-4 minutes)
Opportunity: Incremental linting on changed code only
Performance Improvement: 50-75% faster CI runs!
5. Unify Security Tooling
Observation: Both
golangci-lintandgosecare in tools.goOpportunity: golangci-lint includes gosec as a linter
Benefits:
Then remove separate
gosecinvocations.6. Use Staticcheck Quickfix Set
Opportunity: v2.0.0 added auto-fixable rules
💡 LOW PRIORITY
7. Adopt
golangci-lint fmtCurrent: Separate
make fmttargetOpportunity: Unified formatting in v2.0.0
fmt-go: golangci-lint fmtBenefits: One tool for linting and formatting
8. Add Pre-Commit Hooks
Opportunity: Catch issues before commit
Benefits: Faster feedback loop, fewer CI failures
9. Enable JSON Output for CI
Opportunity: Machine-readable reports
golangci-lint run --json > lint-report.jsonUse Cases: Automated issue tracking, trend analysis
Recommendations Summary
Rating: ⭐⭐⭐⭐ (4/5)
Current implementation is GOOD but loses 1 star for being a major version behind
Priority Actions
golangci-lint migrateto convert configuration--new-from-revfor 50-75% faster CIMigration is Easy!
The golangci-lint team provides an automated migration tool:
This command will:
.golangci.ymlto v2 format automaticallyNext Steps
I recommend:
golangci-lint migrateThe migration is well-documented with a comprehensive [Migration Guide]((redacted) available.
Generated by Go Fan
Module summary saved to:
specs/mods/golangci-lint.mdLast reviewed: 2025-12-23
All reactions