docs/LINTING.md
This document explains our approach to golangci-lint warnings in this codebase.
Running golangci-lint run ./... reports a small number of remaining issues. These are not actual code quality problems - they are false positives or intentional patterns that reflect idiomatic Go practice. Run the command locally to see the current count and breakdown.
Pattern: Unchecked errors from defer cleanup operations
Status: Intentional and idiomatic
Examples:
defer rows.Close()
defer tx.Rollback()
defer os.RemoveAll(tmpDir) // in tests
Rationale: In Go, it's standard practice to ignore errors from deferred cleanup operations:
rows.Close() - closing already-consumed result sets rarely errorstx.Rollback() - rollback on defer is a safety net; if commit succeeded, rollback is a no-opFixing these would add noise without improving code quality. The critical cleanup operations (where errors matter) are already checked explicitly.
Pattern 1: G204 - Subprocess launched with variable Status: Intentional - launching editor and git commands with user-specified paths
Examples:
$EDITOR for issue editingPattern 2: G304 - File inclusion via variable Status: Intended feature - user-specified file paths for import/export
All file paths are either:
Pattern 3: G301/G302/G306 - File permissions Status: Acceptable for user-facing database files
Pattern 4: G201/G202 - SQL string formatting/concatenation Status: Safe - using placeholders and bounded queries
All SQL concatenation uses proper placeholders and is bounded by controlled input (issue ID lists).
Pattern: British vs American spelling - cancelled vs canceled
Status: Acceptable spelling variation
The codebase uses "cancelled" (British spelling) in user-facing messages. Both spellings are correct.
Pattern: Function parameters or return values that are always the same Status: Interface compliance and future-proofing
These functions maintain consistent signatures for:
We've attempted to configure .golangci.yml to exclude these false positives, but golangci-lint's exclusion mechanisms have proven challenging:
exclude-functions works for some errcheck patternsexclude patterns with regex don't match as expectedexclude-rules with text matching doesn't work reliablyThis appears to be a known limitation of golangci-lint's configuration system.
For contributors: Don't be alarmed by the lint warnings reported. The code quality is high.
For code review: Focus on:
For CI/CD: The current GitHub Actions workflow runs linting but doesn't fail on these known issues. We may add --issues-exit-code=0 or configure the workflow to check for regressions only.
Potential approaches to reduce noise:
//nolint directives sparingly for clear false positivesThese "issues" are not technical debt - they represent intentional, idiomatic Go code. The codebase maintains high quality through:
Don't let the linter count distract from the actual code quality.