From 6682d469a1ab3fc9d3e66743d632c927791275cc Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Thu, 12 Feb 2026 14:38:19 -0600 Subject: [PATCH] fix: handle error return values in checks.go Fixed errcheck linter issues: - resp.Body.Close() in HTTP check - conn.Close() in TCP check - conn.SetDeadline() in TCP send/expect --- checks.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/checks.go b/checks.go index a148158..2f54685 100644 --- a/checks.go +++ b/checks.go @@ -105,7 +105,7 @@ func executeHTTPCheck(ctx context.Context, config *pb.HttpCheckConfig, timeoutMs if err != nil { return 2, fmt.Sprintf("Request failed: %v", err), responseTime } - defer resp.Body.Close() + defer func() { _ = resp.Body.Close() }() // Check status code expectedStatus := int(config.ExpectedStatus) @@ -147,11 +147,11 @@ func executeTCPCheck(ctx context.Context, config *pb.TcpCheckConfig, timeoutMs u if err != nil { return 2, fmt.Sprintf("Connection failed: %v", err), responseTime } - defer conn.Close() + defer func() { _ = conn.Close() }() // If send/expect strings provided, test them if config.Send != "" { - conn.SetDeadline(time.Now().Add(timeout)) + _ = conn.SetDeadline(time.Now().Add(timeout)) _, err = conn.Write([]byte(config.Send)) if err != nil {