From 9f1f25d2fa52a0a6f939b1907e9bfb17278e3663 Mon Sep 17 00:00:00 2001 From: Olivier Poitrey Date: Wed, 2 Jan 2019 17:07:20 -0800 Subject: [PATCH] pkgerrors: quick refactoring for better readibility --- pkgerrors/stacktrace.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkgerrors/stacktrace.go b/pkgerrors/stacktrace.go index 4d0b121..01420e6 100644 --- a/pkgerrors/stacktrace.go +++ b/pkgerrors/stacktrace.go @@ -47,12 +47,11 @@ func MarshalStack(err error) interface{} { type stackTracer interface { StackTrace() errors.StackTrace } - var st errors.StackTrace - if err, ok := err.(stackTracer); ok { - st = err.StackTrace() - } else { + sterr, ok := err.(stackTracer) + if !ok { return nil } + st := sterr.StackTrace() s := &state{} out := make([]map[string]string, 0, len(st)) for _, frame := range st {