Files
k8sgpt/pkg
Anas Khan 238a97af1c fix: guard interplex cache Store and Load against nil grpc conn (#1682)
grpc.NewClient returns a nil *ClientConn when it fails (for example on an
invalid connection string). Store and Load registered defer conn.Close()
before checking the returned error, so a client-creation failure triggered a
nil pointer dereference in the deferred Close instead of returning the error.

Move defer conn.Close() to after the error check in both methods. Add a
regression test that drives Store and Load with an invalid connection string
and asserts they return an error without panicking.

The deferred conn.Close() now discards its error with a plain _ = conn.Close()
rather than logging it: grpc's ClientConn.Close() only returns a non-nil error
on a double-close, which can't happen from a single call site here, so a
logging branch would be dead code that patch coverage can never satisfy.

Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
2026-07-06 13:13:57 +01:00
..
2025-12-22 08:24:18 +00:00
2025-12-22 08:24:18 +00:00