From ba6d989c7e48c6a2d76975ced9b3f496c75454fd Mon Sep 17 00:00:00 2001 From: Marvin Zhang Date: Mon, 20 Oct 2025 16:34:55 +0800 Subject: [PATCH] fix(controllers/health): return after responding OK to avoid falling through; tidy imports --- core/controllers/health.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/controllers/health.go b/core/controllers/health.go index 37e71db4..1b94111b 100644 --- a/core/controllers/health.go +++ b/core/controllers/health.go @@ -1,8 +1,9 @@ package controllers import ( - "github.com/gin-gonic/gin" "net/http" + + "github.com/gin-gonic/gin" ) func GetHealthFn(healthFn func() bool) func(c *gin.Context) { @@ -10,6 +11,7 @@ func GetHealthFn(healthFn func() bool) func(c *gin.Context) { if healthFn() { _, _ = c.Writer.Write([]byte("ok")) c.AbortWithStatus(http.StatusOK) + return } _, _ = c.Writer.Write([]byte("not ready")) c.AbortWithStatus(http.StatusServiceUnavailable)