kubernetes/vendor/k8s.io/klog/v2/safeptr.go

// SafePtr is a function that takes a pointer of any type (T) as an argument.
// If the provided pointer is not nil, it returns the same pointer. If it is nil, it returns nil instead.
//
// This function is particularly useful to prevent nil pointer dereferencing when:
//
//   - The type implements interfaces that are called by the logger, such as `fmt.Stringer`.
//   - And these interface implementations do not perform nil checks themselves.
func SafePtr[T any](p *T) any {}