From 372781bd6826020547c1e8ed223c41a36ac05d52 Mon Sep 17 00:00:00 2001 From: Tomas Tormo Date: Mon, 13 Nov 2023 09:43:56 +0000 Subject: [PATCH] Update function description --- safeptr.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/safeptr.go b/safeptr.go index 56c656df..1139fea4 100644 --- a/safeptr.go +++ b/safeptr.go @@ -19,9 +19,11 @@ limitations under the License. package klog -// SafePtr accepts a pointer of any type (T) as an argument and returns th +// SafePtr accepts a pointer of any type (T) as an argument and returns the // same pointer if it's not nil, otherwise it returns nil. -// This function is useful for safely handling pointers and preventing nil pointer dereferencing. +// This function is useful for safely handling pointers and preventing nil pointer dereferencing when the type +// +// a) implements interfaces called by the logger like `fmt.Stringer` and b) those implementations do not check for nil themselves. func SafePtr[T any](p *T) any { if p == nil { return nil