Skip to content

fix(lint): resolve errcheck violations for deferred resource closures#8

Open
i-naman wants to merge 1 commit into
mainfrom
fix/errcheck-closures
Open

fix(lint): resolve errcheck violations for deferred resource closures#8
i-naman wants to merge 1 commit into
mainfrom
fix/errcheck-closures

Conversation

@i-naman
Copy link
Copy Markdown
Member

@i-naman i-naman commented Mar 2, 2026

Description

This PR addresses ~75 errcheck violations across the codebase where errors returned by deferred Close() calls were being silently ignored.

While deferred closures are standard practice, completely ignoring their return values can mask failures during resource teardown (such as failing to flush buffers, release file locks, or close network streams cleanly).

Changes

  • Wrapped stream.Close() calls in AVC, NodeSelection, Sequencer, etc.
  • Wrapped rows.Close() and db.Close() calls in DB_OPs and seedhelper.
  • Wrapped file.Close() calls in transfer, node, and DB_OPs.
  • Wrapped conn.Close() calls for database and network connections.

Impact

This is a non-breaking change. It solely adds visibility into resource leakages and teardown failures by wrapping the closures in anonymous functions to properly catch and log any errors.

Wrapped all deferred 'stream.Close()', 'file.Close()', 'rows.Close()',
and 'conn.Close()' calls in error-handling closures to stop swallowing
teardown errors and resolve ~75 golangci-lint errcheck violations.
Siddharth2812 pushed a commit that referenced this pull request Apr 2, 2026
Siddharth2812 pushed a commit that referenced this pull request Apr 2, 2026
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