diff options
author | Wim <wim@42.be> | 2018-08-06 21:47:05 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2018-08-06 21:47:05 +0200 |
commit | 51062863a5c34d81e296cf15c61140911037cf3b (patch) | |
tree | 9b5e044672486326c7a0ca8fb26430f37bf4d83c /vendor/gopkg.in/airbrake/gobrake.v2/util.go | |
parent | 4fb4b7aa6c02a54db8ad8dd98e4d321396926c0d (diff) | |
download | matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.tar.gz matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.tar.bz2 matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.zip |
Use mod vendor for vendored directory (backwards compatible)
Diffstat (limited to 'vendor/gopkg.in/airbrake/gobrake.v2/util.go')
-rw-r--r-- | vendor/gopkg.in/airbrake/gobrake.v2/util.go | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/vendor/gopkg.in/airbrake/gobrake.v2/util.go b/vendor/gopkg.in/airbrake/gobrake.v2/util.go deleted file mode 100644 index c05c0331..00000000 --- a/vendor/gopkg.in/airbrake/gobrake.v2/util.go +++ /dev/null @@ -1,59 +0,0 @@ -package gobrake - -import ( - "runtime" - "strings" -) - -func stackFilter(packageName, funcName string, file string, line int) bool { - return packageName == "runtime" && funcName == "panic" -} - -type StackFrame struct { - File string `json:"file"` - Line int `json:"line"` - Func string `json:"function"` -} - -func stack(depth int) []StackFrame { - stack := []StackFrame{} - for i := depth; ; i++ { - pc, file, line, ok := runtime.Caller(i) - if !ok { - break - } - packageName, funcName := packageFuncName(pc) - if stackFilter(packageName, funcName, file, line) { - stack = stack[:0] - continue - } - stack = append(stack, StackFrame{ - File: file, - Line: line, - Func: funcName, - }) - } - - return stack -} - -func packageFuncName(pc uintptr) (string, string) { - f := runtime.FuncForPC(pc) - if f == nil { - return "", "" - } - - packageName := "" - funcName := f.Name() - - if ind := strings.LastIndex(funcName, "/"); ind > 0 { - packageName += funcName[:ind+1] - funcName = funcName[ind+1:] - } - if ind := strings.Index(funcName, "."); ind > 0 { - packageName += funcName[:ind] - funcName = funcName[ind+1:] - } - - return packageName, funcName -} |