From f494776931b71f83fdfdd4e68e850529c4b2614f Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 20 Oct 2021 22:37:19 +0800 Subject: Use a variable but a function for IsProd because of a slight performance increment (#17368) --- routers/common/middleware.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'routers/common') diff --git a/routers/common/middleware.go b/routers/common/middleware.go index 1d96522dd9..7c5c72f5cc 100644 --- a/routers/common/middleware.go +++ b/routers/common/middleware.go @@ -62,7 +62,7 @@ func Middlewares() []func(http.Handler) http.Handler { if err := recover(); err != nil { combinedErr := fmt.Sprintf("PANIC: %v\n%s", err, string(log.Stack(2))) log.Error("%v", combinedErr) - if setting.IsProd() { + if setting.IsProd { http.Error(resp, http.StatusText(500), 500) } else { http.Error(resp, combinedErr, 500) -- cgit v1.2.3