• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

axkit / errors / 15131908489

20 May 2025 07:49AM UTC coverage: 91.009% (-0.2%) from 91.17%
15131908489

push

regorov
add migration guide

415 of 456 relevant lines covered (91.01%)

1.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
/stack_frame.go
1
package errors
2

3
import (
4
        "fmt"
5
        "runtime"
6
)
7

8
// StackFrame describes content of a single stack frame stored with error.
9
type StackFrame struct {
10
        Function string `json:"func"`
11
        File     string `json:"file"`
12
        Line     int    `json:"line"`
13
}
14

15
func (s StackFrame) String() string {
×
16
        return fmt.Sprintf("%s:%d %s", s.File, s.Line, s.Function)
×
17
}
×
18

19
var (
20
        // CallerFramesFunc holds default function used by function Catch()
21
        // to collect call frames.
22
        CallerFramesFunc func(offset int) []StackFrame = DefaultCallerFrames
23

24
        // CallingStackMaxLen holds maximum elements in the call frames.
25
        CallingStackMaxLen int = 15
26
)
27

28
// DefaultCallerFrames returns default implementation of call frames collector.
29
func DefaultCallerFrames(offset int) []StackFrame {
1✔
30
        res := make([]StackFrame, 0, 12)
1✔
31
        pc := make([]uintptr, CallingStackMaxLen)
1✔
32
        n := runtime.Callers(3+offset, pc)
1✔
33
        frames := runtime.CallersFrames(pc[:n])
1✔
34

1✔
35
        for {
2✔
36
                frame, more := frames.Next()
1✔
37
                if !more {
2✔
38
                        break
1✔
39
                }
40
                res = append(res, StackFrame{Function: frame.Function, File: frame.File, Line: frame.Line})
1✔
41
        }
42
        return res
1✔
43
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc