style: satisfy wsl_v5 blank-line-before-defer rule
Insert the blank line wsl_v5 requires above four defer statements whose deferred closure does not share a variable with the immediately preceding line, across internal/handlers, internal/httpfetcher, and internal/imgcache. No behavior change.
This commit is contained in:
@@ -66,6 +66,7 @@ func (s *Handlers) HandleImageEnc() http.HandlerFunc {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
defer func() { _ = resp.Content.Close() }()
|
||||
|
||||
// Set response headers
|
||||
|
||||
@@ -198,6 +198,7 @@ func (f *HTTPFetcher) Fetch(ctx context.Context, url string) (*FetchResult, erro
|
||||
|
||||
// If we fail before returning a result, release the slot
|
||||
success := false
|
||||
|
||||
defer func() {
|
||||
if !success {
|
||||
<-sem
|
||||
|
||||
@@ -237,6 +237,7 @@ func TestMockFetcher_FetchesFile(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("Fetch() error = %v", err)
|
||||
}
|
||||
|
||||
defer func() { _ = result.Content.Close() }()
|
||||
|
||||
if result.ContentType != contentTypeJPEG {
|
||||
|
||||
@@ -315,6 +315,7 @@ func (s *Service) fetchAndProcess(
|
||||
|
||||
return nil, fmt.Errorf("upstream fetch failed: %w", err)
|
||||
}
|
||||
|
||||
defer func() { _ = fetchResult.Content.Close() }()
|
||||
|
||||
// Read and validate the source content
|
||||
|
||||
Reference in New Issue
Block a user