github.com/yuqengo/golangci-lint@v0.0.2/internal/errorutil/errors.go (about) 1 package errorutil 2 3 import ( 4 "fmt" 5 ) 6 7 // PanicError can be used to not print stacktrace twice 8 type PanicError struct { 9 recovered interface{} 10 stack []byte 11 } 12 13 func NewPanicError(recovered interface{}, stack []byte) *PanicError { 14 return &PanicError{recovered: recovered, stack: stack} 15 } 16 17 func (e PanicError) Error() string { 18 return fmt.Sprint(e.recovered) 19 } 20 21 func (e PanicError) Stack() []byte { 22 return e.stack 23 }