Skip to content

Commit

Permalink
formatCallStack without more check
Browse files Browse the repository at this point in the history
  • Loading branch information
ungerik committed Sep 20, 2023
1 parent 1b6272f commit 6b122da
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions format.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ func formatError(err error) string {

func formatCallStack(e callStackProvider) string {
stack := e.CallStack()
frame, ok := runtime.CallersFrames(stack).Next()
if !ok {
return "insufficient call stack"
}
frame, _ := runtime.CallersFrames(stack).Next()
return fmt.Sprintf(
"%s\n %s:%d",
frame.Function,
Expand All @@ -63,10 +60,7 @@ func formatCallStack(e callStackProvider) string {

func formatCallStackParams(e callStackParamsProvider) string {
stack, params := e.CallStackParams()
frame, ok := runtime.CallersFrames(stack).Next()
if !ok {
return "insufficient call stack"
}
frame, _ := runtime.CallersFrames(stack).Next()
return fmt.Sprintf(
"%s\n %s:%d",
FormatFunctionCall(frame.Function, params...),
Expand Down

0 comments on commit 6b122da

Please sign in to comment.