Skip to content

[lint-monster] [Lint] Miscellaneous Fixes: Error Handling + String Comparison - 29 findings #37243

@github-actions

Description

@github-actions

Daily lint scan from 2026-06-06

Issue Summary

Two minor linting issues accounting for 29 total findings:

  1. Error discard (10 findings): json.Marshal error returns are ignored, leading to silent nil bytes on marshal failures.
  2. Case-insensitive comparison (18 findings): String comparisons using strings.ToLower/ToUpper instead of strings.EqualFold.

Root Cause

Error Discard

  • Test files where JSON marshalling is used without error checking
  • Accidental omission of error handling in transient test data setup

Case-Insensitive Comparison

  • Inefficient pattern: strings.ToLower(a) == strings.ToLower(b)
  • Should use: strings.EqualFold(a, b) (more efficient, no allocations)
  • Affects config parsing, feature detection, and utilities

Expected Outcome

Error Discard

  • Check marshal error and handle appropriately (e.g., if err != nil { /* handle */ } or _ = err if truly intentional)
  • Tests should validate both success and error paths

Case-Insensitive

  • Replace strings.ToLower(s1) == strings.ToLower(s2) with strings.EqualFold(s1, s2)
  • Replace strings.ToUpper(s1) == strings.ToUpper(s2) with strings.EqualFold(s1, s2)

Remediation Checklist

  • Fix error discard by adding proper error checks to all json.Marshal calls
  • Replace all ToLower/ToUpper comparisons with strings.EqualFold
  • Run make test to ensure tests still pass
  • Run make golint-custom to verify all findings are resolved

Notes

  • These are low-complexity fixes suitable for batch processing
  • Error handling in tests should be explicit or use _ = err with documented rationale
  • No dependencies between the two sub-issues; can be addressed independently

Generated by 🧌 LintMonster · 110.5 AIC · ⌖ 4.45 AIC ·

  • expires on Jun 13, 2026, 3:51 AM UTC

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions