-pkg runtime/debug, func SetCrashOutput(*os.File) error #42888
+pkg runtime/debug, type CrashOptions struct #67182
+pkg runtime/debug, func SetCrashOutput(*os.File, ...CrashOptions) error #42888
}
}
+// CrashOptions provides options that control the formatting of the
+// fatal crash message.
+type CrashOptions struct {
+ /* for future expansion */
+}
+
// SetCrashOutput configures a single additional file where unhandled
// panics and other fatal errors are printed, in addition to standard error.
// There is only one additional file: calling SetCrashOutput again overrides
// To disable this additional crash output, call SetCrashOutput(nil).
// If called concurrently with a crash, some in-progress output may be written
// to the old file even after an overriding SetCrashOutput returns.
-func SetCrashOutput(f *os.File) error {
+//
+// TODO(adonovan): the variadic ... is a short-term measure to avoid
+// breaking the call in x/telemetry; it will be removed before the
+// go1.23 freeze.
+func SetCrashOutput(f *os.File, opts ...CrashOptions) error {
+ if len(opts) > 1 {
+ panic("supply at most 1 CrashOptions")
+ }
fd := ^uintptr(0)
if f != nil {
// The runtime will write to this file descriptor from