From b6cd4c9cdf13bc9343e8c59f5510c9f19ac4d917 Mon Sep 17 00:00:00 2001 From: Alex Jones Date: Thu, 24 Apr 2025 15:46:22 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20fix=20the=20linter=20=F0=9F=A4=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alex Jones --- pkg/cache/interplex_based.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/cache/interplex_based.go b/pkg/cache/interplex_based.go index abf001e..f0493a2 100644 --- a/pkg/cache/interplex_based.go +++ b/pkg/cache/interplex_based.go @@ -3,11 +3,13 @@ package cache import ( "context" "errors" + "fmt" "os" rpc "buf.build/gen/go/interplex-ai/schemas/grpc/go/protobuf/schema/v1/schemav1grpc" schemav1 "buf.build/gen/go/interplex-ai/schemas/protocolbuffers/go/protobuf/schema/v1" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ) var _ ICache = (*InterplexCache)(nil) @@ -91,11 +93,17 @@ func (c *InterplexCache) Remove(key string) error { c.configuration.ConnectionString = "localhost:8084" } - conn, err := grpc.NewClient(c.configuration.ConnectionString, grpc.WithInsecure(), grpc.WithBlock()) - defer conn.Close() + conn, err := grpc.NewClient(c.configuration.ConnectionString, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) if err != nil { return err } + defer func() { + if err := conn.Close(); err != nil { + // Log the error but don't return it since this is a deferred function + fmt.Printf("Error closing connection: %v\n", err) + } + }() + serviceClient := rpc.NewCacheServiceClient(conn) c.cacheServiceClient = serviceClient req := schemav1.DeleteRequest{