From 7664a472e500aa512749e58e5e171baef8d6c6b9 Mon Sep 17 00:00:00 2001 From: ono-teruya <27873650+teru01@users.noreply.github.com> Date: Sun, 12 May 2024 17:10:09 +0900 Subject: [PATCH] fix: use unwrap --- errors.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/errors.go b/errors.go index f948770..0ded8f0 100644 --- a/errors.go +++ b/errors.go @@ -129,7 +129,12 @@ func (x *Error) Format(s fmt.State, verb rune) { if s.Flag('+') { _, _ = io.WriteString(s, x.Error()) var c *Error - for c = x; c.cause != nil; c = c.cause.(*Error) { + for c = x; c.Unwrap() != nil; { + cause, ok := c.Unwrap().(*Error) + if !ok { + break + } + c = cause } c.st.Format(s, verb) return