luraproject / lura

Exit inside non-main function RVV-A0003
Anti-pattern
Major
6 months ago2 years old
calls to log.Fatal only in main() or init() functions
377func testKeysAreAvailable(t *testing.T) {
378	files, err := os.ReadDir(".")
379	if err != nil {
380		log.Fatal(err)381	}
382
383	for _, k := range []string{"cert.pem", "key.pem"} {
calls to os.Exit only in main() or init() functions
106// Fatal is equivalent to l.Critical(fmt.Sprint()) followed by a call to os.Exit(1).
107func (l BasicLogger) Fatal(v ...interface{}) {
108	l.prependLog("FATAL:", v...)
109	os.Exit(1)110}
111
112func (l BasicLogger) prependLog(level string, v ...interface{}) {