From 2fe39a2c0afa07ba27aea519c1d5a773af697069 Mon Sep 17 00:00:00 2001 From: MohitKatare-protean Date: Mon, 31 Mar 2025 23:16:26 +0530 Subject: [PATCH] resolved linting issues --- core/module/client/registry_test.go | 16 ++++++++++++---- pkg/plugin/implementation/router/router.go | 2 -- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/core/module/client/registry_test.go b/core/module/client/registry_test.go index 5185597..608c328 100644 --- a/core/module/client/registry_test.go +++ b/core/module/client/registry_test.go @@ -27,7 +27,9 @@ func (m *MockRegistryClient) Subscribe(ctx context.Context, subscription *model. func TestSubscribeSuccess(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) - w.Write([]byte("{}")) + if _, err := w.Write([]byte("{}")); err != nil { + t.Errorf("failed to write response: %v", err) + } })) defer server.Close() @@ -125,7 +127,9 @@ func TestLookupSuccess(t *testing.T) { }, } bodyBytes, _ := json.Marshal(response) - w.Write(bodyBytes) + if _, err := w.Write(bodyBytes); err != nil { + t.Errorf("failed to write response: %v", err) + } })) defer server.Close() @@ -194,10 +198,14 @@ func TestLookupFailure(t *testing.T) { } if tc.responseBody != nil { if str, ok := tc.responseBody.(string); ok { - w.Write([]byte(str)) + if _, err := w.Write([]byte(str)); err != nil { + t.Errorf("failed to write response: %v", err) + } } else { bodyBytes, _ := json.Marshal(tc.responseBody) - w.Write(bodyBytes) + if _, err := w.Write(bodyBytes); err != nil { + t.Errorf("failed to write response: %v", err) + } } } })) diff --git a/pkg/plugin/implementation/router/router.go b/pkg/plugin/implementation/router/router.go index beaac8b..1eb08ca 100644 --- a/pkg/plugin/implementation/router/router.go +++ b/pkg/plugin/implementation/router/router.go @@ -9,7 +9,6 @@ import ( "path" "strings" - "github.com/beckn/beckn-onix/pkg/log" "github.com/beckn/beckn-onix/pkg/model" "gopkg.in/yaml.v3" @@ -213,7 +212,6 @@ func (r *Router) Route(ctx context.Context, url *url.URL, body []byte) (*model.R if err := json.Unmarshal(body, &requestBody); err != nil { return nil, fmt.Errorf("error parsing request body: %w", err) } - log.Debugf(ctx, "In Router: Routing request with %v and body: %v", url, requestBody) // Extract the endpoint from the URL endpoint := path.Base(url.Path)