Skip to content

Fix golangci-lint errcheck violations - v2.6.14#41

Merged
ziembor merged 1 commit intomainfrom
fix-build-and-lint-v2.6.14
Jan 31, 2026
Merged

Fix golangci-lint errcheck violations - v2.6.14#41
ziembor merged 1 commit intomainfrom
fix-build-and-lint-v2.6.14

Conversation

@ziembor
Copy link
Copy Markdown
Owner

@ziembor ziembor commented Jan 31, 2026

Summary

This PR fixes all golangci-lint errcheck violations to ensure clean CI/CD builds.

Changes

Code Quality Fixes

Resolved 6 errcheck violations by adding explicit error ignoring for csvLogger calls:

  • cmd/smtptool/teststarttls.go: 7 fixes (lines 27, 41, 60, 75, 88, 115, 172)
  • cmd/jmaptool/testconnect.go: 3 fixes (lines 22, 34, 63)
  • cmd/jmaptool/getmailboxes.go: 4 fixes (lines 21, 33, 49, 71)
  • cmd/jmaptool/testauth.go: 3 fixes (lines 21, 39, 85)

Total: 17 lines changed across 4 Go source files

Documentation

  • Added ChangeLog/2.6.14.md documenting all changes

Approach

Used explicit error ignoring pattern (_ = csvLogger.Write...()) which:

  • Makes linter happy immediately
  • Aligns with established pattern in 9 existing files (POP3/IMAP tools)
  • Provides quick fix to unblock CI/CD
  • No .golangci.yml configuration changes needed

Impact

  • ✅ golangci-lint job will pass
  • ✅ Build system unblocked
  • ✅ Code quality standards maintained
  • ✅ Error handling pattern consistent across JMAP/SMTP tools

Testing

After merge, GitHub Actions will:

  1. Run golangci-lint (should pass)
  2. Run tests on all 3 platforms (should pass)
  3. Build release artifacts for Windows, Linux, macOS

Future Work

Consider creating a follow-up task to standardize all 14 csvLogger files to use proper error handling with logging (like cmd/smtptool/testconnect.go), rather than explicit error ignoring.


🤖 Generated with Claude Code

Resolved 6 errcheck violations by adding explicit error ignoring
for csvLogger.WriteHeader() and csvLogger.WriteRow() calls.

Changes:
- cmd/smtptool/teststarttls.go: Fixed 7 unchecked calls (lines 27, 41, 60, 75, 88, 115, 172)
- cmd/jmaptool/testconnect.go: Fixed 3 unchecked calls (lines 22, 34, 63)
- cmd/jmaptool/getmailboxes.go: Fixed 4 unchecked calls (lines 21, 33, 49, 71)
- cmd/jmaptool/testauth.go: Fixed 3 unchecked calls (lines 21, 39, 85)
- Added ChangeLog/2.6.14.md

Total: 17 lines changed across 4 Go source files

This uses the explicit error ignoring pattern (_ =) which aligns
with the established pattern in 9 existing files (POP3/IMAP tools).

Future work: Consider standardizing all 14 csvLogger files to use
proper error handling with logging (like cmd/smtptool/testconnect.go).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@ziembor ziembor merged commit dfc1a11 into main Jan 31, 2026
5 checks passed
@ziembor ziembor deleted the fix-build-and-lint-v2.6.14 branch January 31, 2026 14:29
@claude
Copy link
Copy Markdown

claude bot commented Jan 31, 2026

Pull Request Review: Fix golangci-lint errcheck violations - v2.6.14

Overview

This PR addresses golangci-lint errcheck violations by adding explicit error ignoring (_ = ) to csvLogger calls across JMAP and SMTP tools. The changes are straightforward and fix immediate CI/CD blocking issues.


✅ Positive Aspects

  1. Immediate Problem Resolution: Successfully addresses the errcheck violations that were blocking CI/CD builds
  2. Consistency: Uses the same pattern across all affected files
  3. Clean Diff: Changes are minimal and focused - only adding _ = prefix to relevant lines
  4. Good Documentation: Excellent changelog entry with detailed breakdown of all changes
  5. Transparent Communication: PR description acknowledges this as a quick fix and identifies better long-term solution

⚠️ Code Quality Issues

Critical Issue: Inconsistent Error Handling Pattern

The codebase now has two different error handling patterns for csvLogger:

Pattern 1 (This PR): Explicit error ignoring

_ = csvLogger.WriteHeader(columns)
_ = csvLogger.WriteRow([]string{...})

Pattern 2 (Existing in testconnect.go, sendmail.go, testauth.go): Proper error checking with logging

if err := csvLogger.WriteHeader(columns); err != nil {
    logger.LogError(slogLogger, "Failed to write CSV header", "error", err)
}
if logErr := csvLogger.WriteRow([]string{...}); logErr != nil {
    logger.LogError(slogLogger, "Failed to write CSV row", "error", logErr)
}

Why this matters:

  • CSV logging is a core feature mentioned in documentation (AGENTS.md lines 56-60, 149-151)
  • Users rely on CSV output for automation and analysis
  • Silent failures mean users won't know their logs are incomplete
  • The logger interface returns errors for a reason - disk full, permission issues, etc.

Recommendation

While this PR is acceptable as a quick fix to unblock CI/CD, I strongly recommend:

  1. Accept this PR to unblock builds immediately
  2. Create follow-up issue to standardize all 17 files to use Pattern 2 (proper error handling)
  3. Priority: Medium - should be addressed in next sprint

The files that need standardization:

  • cmd/smtptool/teststarttls.go (7 locations)
  • cmd/jmaptool/testconnect.go (3 locations)
  • cmd/jmaptool/getmailboxes.go (4 locations)
  • cmd/jmaptool/testauth.go (3 locations)

📋 Other Observations

Documentation

  • Excellent: ChangeLog/2.6.14.md is comprehensive and well-structured
  • Contains clear breakdown of changes, impact, and future work section
  • Minor note: Commit hash TBD placeholders at bottom should be filled before merge

Security

  • ✅ No security concerns
  • All changes are additive (adding _ = ) with no logic changes

Performance

  • ✅ No performance impact
  • Same operations, just different error handling

Test Coverage

  • ⚠️ Note: No new tests added, but this is acceptable since:
    • Changes don't modify logic
    • Existing behavior unchanged
    • Tests would need to test error paths in logger, which is out of scope

Build System

  • ✅ Changes align with GitHub Actions workflow (.github/workflows/build.yml)
  • Targets the exact linter configuration causing issues

🎯 Final Verdict

Recommendation: APPROVE with follow-up task

This PR is a pragmatic solution that:

  • ✅ Solves the immediate CI/CD blocking issue
  • ✅ Uses minimal changes with low risk
  • ✅ Is well-documented
  • ⚠️ Introduces technical debt (inconsistent error handling)

Action Items:

  1. ✅ Merge this PR to unblock CI/CD
  2. 📝 Create follow-up issue: "Standardize csvLogger error handling across all tools"
  3. 🔧 In follow-up: Convert all 17 instances to use proper error logging pattern

Alternative (if time permits): Consider updating this PR to use the proper error handling pattern instead of _ = . This would:

  • Eliminate technical debt before it's introduced
  • Provide better diagnostics for users
  • Match existing patterns in testconnect.go and sendmail.go
  • Still fix the errcheck violations

📚 Reference Files Reviewed

  • ✅ cmd/smtptool/teststarttls.go
  • ✅ cmd/jmaptool/testconnect.go
  • ✅ cmd/jmaptool/getmailboxes.go
  • ✅ cmd/jmaptool/testauth.go
  • ✅ cmd/smtptool/testconnect.go (for comparison)
  • ✅ internal/common/logger/logger.go
  • ✅ ChangeLog/2.6.14.md
  • ✅ AGENTS.md

Reviewed by: Claude Sonnet 4.5 (claude-code)

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.

1 participant