pkgerrors: quick refactoring for better readibility

This commit is contained in:
Olivier Poitrey 2019-01-02 17:07:20 -08:00
parent 6d2153805b
commit 9f1f25d2fa
1 changed files with 3 additions and 4 deletions

View File

@ -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 {