Skip to content

Commit 6e0e72a

Browse files
Fix defer placement for response body closing
Co-authored-by: SamMorrowDrums <4811358+SamMorrowDrums@users.noreply.github.com>
1 parent 3f87488 commit 6e0e72a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/github/issues.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,8 +859,8 @@ func AddSubIssue(ctx context.Context, client *github.Client, owner string, repo
859859

860860
// Handle non-201 status codes after retries exhausted
861861
if lastResp != nil && lastResp.StatusCode != http.StatusCreated {
862-
body, err := io.ReadAll(lastResp.Body)
863862
defer func() { _ = lastResp.Body.Close() }()
863+
body, err := io.ReadAll(lastResp.Body)
864864
if err != nil {
865865
return nil, fmt.Errorf("failed to read response body: %w", err)
866866
}

0 commit comments

Comments
 (0)