mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-14 14:23:37 +00:00
apiserver: avoid TODO in public docs
As pointed out in https://github.com/kubernetes/kubernetes/pull/126387#discussion_r1811009830, having TODOs in the Go doc comments makes them visible to downstream developers. Using "Contextual logging: " as special prefix serves the same purpose (search/replace as explained in https://github.com/kubernetes/kubernetes/issues/126379) and makes the doc comment human-readable. Keeping that information visible is useful because developers might care, even if logcheck doesn't warn them yet.
This commit is contained in:
parent
e15d5b9da9
commit
fc6e0a5799
@ -45,7 +45,7 @@ var PanicHandlers = []func(context.Context, interface{}){logPanic}
|
|||||||
//
|
//
|
||||||
// E.g., you can provide one or more additional handlers for something like shutting down go routines gracefully.
|
// E.g., you can provide one or more additional handlers for something like shutting down go routines gracefully.
|
||||||
//
|
//
|
||||||
// TODO(pohly): logcheck:context // HandleCrashWithContext should be used instead of HandleCrash in code which supports contextual logging.
|
// Contextual logging: HandleCrashWithContext should be used instead of HandleCrash in code which supports contextual logging.
|
||||||
func HandleCrash(additionalHandlers ...func(interface{})) {
|
func HandleCrash(additionalHandlers ...func(interface{})) {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
additionalHandlersWithContext := make([]func(context.Context, interface{}), len(additionalHandlers))
|
additionalHandlersWithContext := make([]func(context.Context, interface{}), len(additionalHandlers))
|
||||||
@ -146,7 +146,7 @@ type ErrorHandler func(ctx context.Context, err error, msg string, keysAndValues
|
|||||||
// is preferable to logging the error - the default behavior is to log but the
|
// is preferable to logging the error - the default behavior is to log but the
|
||||||
// errors may be sent to a remote server for analysis.
|
// errors may be sent to a remote server for analysis.
|
||||||
//
|
//
|
||||||
// TODO(pohly): logcheck:context // HandleErrorWithContext should be used instead of HandleError in code which supports contextual logging.
|
// Contextual logging: HandleErrorWithContext should be used instead of HandleError in code which supports contextual logging.
|
||||||
func HandleError(err error) {
|
func HandleError(err error) {
|
||||||
// this is sometimes called with a nil error. We probably shouldn't fail and should do nothing instead
|
// this is sometimes called with a nil error. We probably shouldn't fail and should do nothing instead
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user