-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.go
37 lines (34 loc) · 881 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package errors
import (
"io"
"path"
"runtime"
"runtime/debug"
)
var Config struct {
StackTraceFormatter func(err *Error, verbosity int) string
FrameFormatter func(w io.Writer, frame *Frame, verbosity int) string
Verbosity int
BasePath string
BaseCachePath string
BaseModule string
BaseGoSrcPath string
BaseGoSrcToken string
MaxStackDepth int
MaxPrintStackFrames int
MaxPrintCauses int
}
func init() {
Config.Verbosity = 5
Config.MaxStackDepth = 32
Config.MaxPrintCauses = 5
Config.MaxPrintStackFrames = 5
Config.BaseCachePath = "**/pkg/mod/"
Config.BaseGoSrcPath = runtime.GOROOT() + "/"
Config.BaseGoSrcToken = runtime.Version()
bi, ok := debug.ReadBuildInfo()
if ok && bi.Path != "" {
Config.BaseModule = bi.Path + "/"
Config.BasePath = "**/" + path.Base(Config.BaseModule) + "/"
}
}