Skip to content

Check config file close errors - #1

Merged
cyberphor merged 1 commit into
mainfrom
fix/check-config-close-error
Oct 14, 2026
Merged

cyberphor merged 1 commit into
mainfrom
fix/check-config-close-error

Conversation

@cyberphor

Copy link
Copy Markdown
Contributor

Issue

The scheduled CI workflow fails its Code Lint Scan because golangci-lint reports an unchecked file.Close() return value in convert/loadConfig.

Discussion

The configuration loader deferred file.Close() without checking the returned error. This caused the errcheck linter to fail every scheduled CI run even though the other scan jobs passed. Ignoring the error could also hide a filesystem failure that occurs while closing the configuration file. When decoding and closing both fail, callers need access to both errors instead of losing either one.

Recommendation

Check the close result, return it when it is the only failure, and combine it with a decode failure using errors.Join. Add focused tests for both close-error paths.

@cyberphor
cyberphor merged commit 27e8c52 into main Oct 14, 2026
5 of 6 checks passed

This branch had an error being deployed

1 failed deployment
github-pages — 5931f78e Deployed Oct 14, 2026 by cyberphor via Deploy #4
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