From f8d77fe197273bb09e5d2d24134632b0b15dff42 Mon Sep 17 00:00:00 2001 From: ono-teruya <27873650+teru01@users.noreply.github.com> Date: Sun, 12 May 2024 16:34:30 +0900 Subject: [PATCH] get the root cause of error and print its stack --- errors.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/errors.go b/errors.go index 2a40666..f948770 100644 --- a/errors.go +++ b/errors.go @@ -128,7 +128,10 @@ func (x *Error) Format(s fmt.State, verb rune) { case 'v': if s.Flag('+') { _, _ = io.WriteString(s, x.Error()) - x.st.Format(s, verb) + var c *Error + for c = x; c.cause != nil; c = c.cause.(*Error) { + } + c.st.Format(s, verb) return } fallthrough