Skip to content

Conversation

@moonD4rk
Copy link
Owner

@moonD4rk moonD4rk commented Sep 2, 2025

Summary

  • Upgraded golangci-lint from v1 to v2 configuration format for better maintainability
  • Updated GitHub Actions workflow from v6 to v8 with golangci-lint v2.2.0
  • Established a permissive baseline configuration to unblock development

Background

This project hasn't been updated for a while and was using an outdated golangci-lint v1 configuration that was incompatible with modern tooling. The CI/CD pipeline was failing due to configuration incompatibilities. This PR modernizes the linting infrastructure while temporarily relaxing rules to allow gradual code quality improvements.

Changes Made

  1. Configuration Migration: Migrated .golangci.yml from v1 to v2 format
  2. GitHub Actions Update: Updated workflow to use golangci-lint-action@v8 with v2.2.0
  3. Formatter Separation: Configured formatters (gofmt, goimports, gci) separately per v2 requirements
  4. Go 1.20 Compatibility: Ensured all configurations work with Go 1.20

Temporarily Disabled Linters and Rules

To unblock development and allow gradual improvements, the following checks have been temporarily suppressed:

Disabled Linters

  • exhaustruct - Struct field completeness (too strict)
  • wrapcheck - Error wrapping check (project specific)
  • testpackage - Test package separation (not conventional)
  • paralleltest - Parallel test check (not always needed)
  • nlreturn - Newline before return (too strict)
  • wsl - Whitespace rules (too strict)
  • gochecknoglobals - No global variables (sometimes needed)
  • gochecknoinits - No init functions (sometimes needed)
  • exhaustive - Enum completeness (too strict initially)
  • unused - Temporarily disabled for gradual cleanup

Excluded Error Patterns

  • Package comment requirements
  • Error return value checks (handled by errcheck with specific exclusions)
  • Security false positives (hardcoded credentials, weak crypto for compatibility)
  • Variable naming issues in types package
  • Field/function unused warnings (for later cleanup)
  • Defer statement errors in cleanup code

File-Specific Exclusions

  • Test files: Relaxed rules for duplication, length, magic numbers
  • Generated files: All linters disabled for .pb.go files
  • Vendor directory: All checks disabled

Next Steps

  1. Gradually re-enable linters one by one as code is refactored
  2. Address technical debt in manageable chunks
  3. Improve test coverage and code quality iteratively
  4. Eventually reach stricter linting standards

Test Plan

  • Verified golangci-lint runs without errors locally
  • Confirmed GitHub Actions workflow passes
  • Ensured Go 1.20 compatibility
  • Validated that development is no longer blocked by linting errors

- Migrate from golangci-lint v1 to v2 configuration format
- Update GitHub Actions workflow to use golangci-lint-action@v8
- Set golangci-lint version to v2.2.0 for stability
- Add comprehensive linter configuration with Go 1.20 compatibility
- Temporarily disable strict linting rules to unblock development
- Configure formatters (gofmt, goimports, gci) separately per v2 requirements
- Add extensive exclusion rules for gradual rule enforcement

This change establishes a modern linting baseline that can be progressively
enhanced as code quality improves. All major linting issues have been
configured as non-blocking to allow incremental improvements.
- Update golangci-lint version from v2.2.0 to v2.4.0 in GitHub Actions
- Aligns CI environment with local development version
- Resolves configuration validation errors
- Remove deprecated v1 fields (skip-dirs, skip-files from run section)
- Move exclusions to linters.exclusions section
- Fix goimports.local-prefixes to be array format
- Remove gci.skip-generated and custom-order (not supported)
- Replace disable-all with default: standard
- Remove deprecated issues section, use linters.exclusions instead
- Fix output format from colored-line-number to text with colors
- Remove unsupported fields from linter settings

This ensures the config passes 'golangci-lint config verify' validation
@moonD4rk moonD4rk merged commit d101da6 into main Sep 2, 2025
6 checks passed
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