MCPcopy
hub / github.com/pkg/errors / Errorf

Function Errorf

errors.go:112–117  ·  view source on GitHub ↗

Errorf formats according to a format specifier and returns the string as a value that satisfies error. Errorf also records the stack trace at the point it was called.

(format string, args ...interface{})

Source from the content-addressed store, hash-verified

110// as a value that satisfies error.
111// Errorf also records the stack trace at the point it was called.
112func Errorf(format string, args ...interface{}) error {
113 return &fundamental{
114 msg: fmt.Sprintf(format, args...),
115 stack: callers(),
116 }
117}
118
119// fundamental is an error that has a message and a stack, but no caller.
120type fundamental struct {

Callers 7

TestFormatErrorfFunction · 0.85
TestFormatWithStackFunction · 0.85
TestFormatWithMessageFunction · 0.85
TestFormatGenericFunction · 0.85
TestErrorfFunction · 0.85
TestErrorEqualityFunction · 0.85
TestStackTraceFunction · 0.85

Calls 1

callersFunction · 0.85

Tested by 7

TestFormatErrorfFunction · 0.68
TestFormatWithStackFunction · 0.68
TestFormatWithMessageFunction · 0.68
TestFormatGenericFunction · 0.68
TestErrorfFunction · 0.68
TestErrorEqualityFunction · 0.68
TestStackTraceFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…