Skip to content

Commit

Permalink
move defer
Browse files Browse the repository at this point in the history
  • Loading branch information
tashima42 committed Sep 25, 2024
1 parent acc4c48 commit 7fcfd40
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions release/rancher/rancher.go
Original file line number Diff line number Diff line change
Expand Up @@ -983,10 +983,11 @@ func remoteTextFileToSlice(url string) ([]string, error) {
if err != nil {
return nil, err
}
if res.StatusCode != 200 {
defer res.Body.Close()

if res.StatusCode != 200 {
return nil, errors.New("expected status code to be 200, got: " + res.Status)
}
defer res.Body.Close()

var file []string
scanner := bufio.NewScanner(res.Body)
Expand Down

0 comments on commit 7fcfd40

Please sign in to comment.