Skip to content

fix(lint): check all unchecked error return values#381

Open
claudiodangelis wants to merge 2 commits into
mainfrom
fix/linter-errors
Open

fix(lint): check all unchecked error return values#381
claudiodangelis wants to merge 2 commits into
mainfrom
fix/linter-errors

Conversation

@claudiodangelis

Copy link
Copy Markdown
Owner

Summary

  • Check return value of tmpfile.Close() in util/util.go before renaming the file
  • Replace defer file.Close() with an immediate checked close in config/config.go
  • Wrap os.Remove calls in config/config_test.go deferred cleanups with _ = to satisfy errcheck
  • Check keyboard.Close() return value in cmd/send.go and cmd/receive.go
  • Suppress unchecked fmt.Fprintf and out.Close errors in server/server.go upload handler (connection may already be broken at that point)

Test plan

  • go build ./... passes
  • go test ./... passes
  • CI lint job passes (errcheck violations resolved)

Addresses errcheck linter failures in:
- util/util.go: tmpfile.Close before rename
- config/config.go: file.Close after creation
- config/config_test.go: os.Remove in deferred cleanup
- cmd/send.go, cmd/receive.go: keyboard.Close in defer
- server/server.go: fmt.Fprintf and out.Close in upload handler
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