From 570daff356c2f3c2ee9f2a2aca8948e42dd74f14 Mon Sep 17 00:00:00 2001 From: Andrei Matei Date: Tue, 21 Apr 2020 11:16:37 -0400 Subject: [PATCH] util/log: fix lying comment SetExitFunc() claimed that a nil function was a way to reset it. It wasn't; it'd lead to a crash. Release note: None --- pkg/util/log/exit_override.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/util/log/exit_override.go b/pkg/util/log/exit_override.go index df9666800f01..3c711b675864 100644 --- a/pkg/util/log/exit_override.go +++ b/pkg/util/log/exit_override.go @@ -21,8 +21,11 @@ import ( // if true, suppresses the stack trace, which is useful for test // callers wishing to keep the logs reasonably clean. // -// Call with a nil function to undo. +// Use ResetExitFunc() to reset. func SetExitFunc(hideStack bool, f func(int)) { + if f == nil { + panic("nil exit func invalid") + } setExitErrFunc(hideStack, func(x int, err error) { f(x) }) }