MCPcopy
hub / github.com/NVIDIA/aistore / _panic

Function _panic

cmn/debug/debug_on.go:89–113  ·  view source on GitHub ↗
(a ...interface{})

Source from the content-addressed store, hash-verified

87func Func(f func()) { f() }
88
89func _panic(a ...interface{}) {
90 msg := "DEBUG PANIC: "
91 if len(a) > 0 {
92 msg += fmt.Sprint(a...) + ": "
93 }
94 buffer := bytes.NewBuffer(make([]byte, 0, 1024))
95 fmt.Fprint(buffer, msg)
96 for i := 2; i < 9; i++ {
97 if _, file, line, ok := runtime.Caller(i); !ok {
98 break
99 } else {
100 if !strings.Contains(file, "aistore") {
101 break
102 }
103 f := filepath.Base(file)
104 if buffer.Len() > len(msg) {
105 buffer.WriteString(" <- ")
106 }
107 fmt.Fprintf(buffer, "%s:%d", f, line)
108 }
109 }
110 glog.Errorf("%s", buffer.Bytes())
111 glog.Flush()
112 panic(msg)
113}
114
115func Assert(cond bool, a ...interface{}) {
116 if !cond {

Callers 5

AssertFunction · 0.85
AssertFuncFunction · 0.85
AssertMsgFunction · 0.85
AssertNoErrFunction · 0.85
AssertfFunction · 0.85

Calls 6

ErrorfFunction · 0.92
FlushFunction · 0.92
WriteStringMethod · 0.80
LenMethod · 0.65
ContainsMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected