From 6e85852c290f41059db1b533c621f1c5cfcf72bf Mon Sep 17 00:00:00 2001 From: Jonathon Anderson Date: Tue, 17 Feb 2026 14:57:32 -0700 Subject: [PATCH] Move defer out of the for loop Signed-off-by: Jonathon Anderson --- internal/app/wwclient/root.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/app/wwclient/root.go b/internal/app/wwclient/root.go index 9467c931..a666da22 100644 --- a/internal/app/wwclient/root.go +++ b/internal/app/wwclient/root.go @@ -326,7 +326,6 @@ func updateSystem(target string, ipaddr string, port int, wwid string, tag strin wwlog.Debug("making request: %s", getURL) resp, err = Webclient.Get(getURL.String()) if err == nil { - defer resp.Body.Close() break } else { var certificateInvalidError x509.CertificateInvalidError @@ -348,6 +347,7 @@ func updateSystem(target string, ipaddr string, port int, wwid string, tag strin } time.Sleep(1000 * time.Millisecond) } + defer resp.Body.Close() if resp.StatusCode != 200 { wwlog.Warn("not applying runtime overlay: got status code: %d", resp.StatusCode) time.Sleep(60000 * time.Millisecond)