Workhorse error handling in deferred functions
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=460662) </details> <!--IssueSummary end--> ### Problem `golangci` linter complains about lack of verification for errors in deferred functions. ``` Error return value of `content.Close` is not checked (errcheck) ``` During the refactoring this problem was addressed in several ways: 1. Log an error in `defer` function ```go defer func() { if err = content.Close(); err != nil { fmt.Printf("Error closing file: %v", err) } }() ``` [source](https://gitlab.com/gitlab-org/gitlab/-/blob/d99525afeb031870797944a55a19f6a1c19b0a8d/workhorse/internal/sendfile/sendfile.go#L132-136) 2. Ignore the error ```go defer func() { _ = body.Close() }() ``` [source](https://gitlab.com/gitlab-org/gitlab/blob/0744271ad9f6f8d5ef3a286cfa2f7a7882c03c1f/workhorse/internal/upstream/handlers.go#L37) Currently, the codebase includes both options. ### Proposal 1. Discuss and define how should we handle this case 2. Document the decision 2. Unify codebase to follow the same approach 3. Try to enforce it via golangci (if possible)
issue