From 4cdae2d3f1e4fc4584cab8dacf202afcdd255172 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Thu, 2 Feb 2023 18:52:36 +0100 Subject: [PATCH] internal/api/debug.go: no need to return error in parseResponse() as it is always nil. --- internal/api/debug.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/internal/api/debug.go b/internal/api/debug.go index a9480dd..8c3a4f4 100644 --- a/internal/api/debug.go +++ b/internal/api/debug.go @@ -10,18 +10,18 @@ type DebugApi struct { response agentcheck.Response } -func parseResponse(resp string) (agentcheck.Response, error) { +func parseResponse(resp string) agentcheck.Response { parts := strings.SplitN(resp, "#", 2) // Status with message if len(parts) > 1 { rtype := agentcheck.StatusMessageResponseType(parts[0]) - return agentcheck.NewStatusMessageResponse(rtype, parts[1]), nil + return agentcheck.NewStatusMessageResponse(rtype, parts[1]) } // Only status. - rtype := agentcheck.StatusResponseType(parts[0]) - return agentcheck.NewStatusResponse(rtype), nil + rtype := agentcheck.StatusResponseType(resp) + return agentcheck.NewStatusResponse(rtype) } func DebugApiFactory(args ApiArguments) ApiInterface { @@ -29,10 +29,8 @@ func DebugApiFactory(args ApiArguments) ApiInterface { } func NewDebugApi(response string) DebugApi { - resp, _ := parseResponse(response) - return DebugApi{ - response: resp, + response: parseResponse(response), } }