lint: resolve all errcheck findings #582
Labels
No labels
breaking
bug
documentation
enhancement
epic
good first issue
help wanted
refactoring
resolution/duplicate
resolution/invalid
resolution/wontfix
security
severity/critical
severity/high
severity/low
severity/medium
status/abandoned
status/blocked
status/needs-decision
status/needs-info
status/needs-verification
testing
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sixfold-space/madtea#582
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
errcheck reports 50 findings in non-test code. The convention is to never
silence an error without cause. Use a blank assignment only for a call that
cannot fail or that is deliberately best-effort, and make the reason obvious
from the surrounding code.
What
Fix every errcheck finding. Handle these patterns:
defer x.Close()and cleanup calls (response body close, file close,os.Remove, server close): blank-assign or log and continue.
fmt.Fprint,fmt.Fprintf,fmt.Fprintlnto fixed writers (CLI and statusoutput).
cmd.MarkFlagRequired(...)in command wiring: infallible, blank-assign.json.Unmarshalon internally produced envelopes ininternal/cmd/issue/get.go:check the error.
per site, either propagate the error or ignore it deliberately with a
comment.
Files touched:
internal/cmd/{actions/artifacts, file/file, install/install, issue/get, orglabels/orglabels, root, setup/prompt, tagapi/tagapi}.go,internal/format/{list,output}.go,internal/gitea/{client_activitypub, client_http, client_pr}.go,internal/parity/{readme_command_drift, stale_command_ref_drift}.go,internal/safeio/atomic.go,internal/service/{git/clone, issueimport/checkpoint, orchestrate/*, workflow/finish_classify}.go.Acceptance
go test ./...stays green, with no behavior change on any exercised path.