renamed CallTrace to CallStack and implemented Error.Stack() method
This commit is contained in:
10
calltrace.go
10
calltrace.go
@ -6,15 +6,15 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// CallTrace represents a call stack trace similar to Java's stack trace
|
||||
type CallTrace struct {
|
||||
// CallStack represents a call stack trace similar to Java's stack trace
|
||||
type CallStack struct {
|
||||
frames *runtime.Frames
|
||||
more bool
|
||||
}
|
||||
|
||||
// Trace returns a new CallTrace starting from this call
|
||||
// Use skip to skip the first entries in the trace
|
||||
func Trace(skip int) *CallTrace {
|
||||
func Trace(skip int) *CallStack {
|
||||
if DisableTrace {
|
||||
return nil
|
||||
}
|
||||
@ -22,10 +22,10 @@ func Trace(skip int) *CallTrace {
|
||||
pc := make([]uintptr, CallStackLength+1)
|
||||
n := runtime.Callers(skip+1, pc)
|
||||
pc = pc[:n]
|
||||
return &CallTrace{runtime.CallersFrames(pc), n == CallStackLength+1}
|
||||
return &CallStack{runtime.CallersFrames(pc), n == CallStackLength+1}
|
||||
}
|
||||
|
||||
func (ct *CallTrace) String() string {
|
||||
func (ct *CallStack) String() string {
|
||||
if ct == nil {
|
||||
return ""
|
||||
}
|
||||
|
Reference in New Issue
Block a user