From 8c590fbdf52db4b458ec8974ed10eae3f573499e Mon Sep 17 00:00:00 2001 From: Agustin Godnic Date: Tue, 13 Jun 2023 17:45:27 -0300 Subject: [PATCH] Make functions private --- common/health/http.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/common/health/http.go b/common/health/http.go index cf8a7017..82a66d36 100644 --- a/common/health/http.go +++ b/common/health/http.go @@ -23,10 +23,10 @@ func NewServer(logger *zap.Logger, port string, pprofEnabled bool, checks ...Che app.Use(pprof.New()) } - ctrl := NewController(checks, logger) + ctrl := newController(checks, logger) api := app.Group("/api") - api.Get("/health", ctrl.HealthCheck) - api.Get("/ready", ctrl.ReadinessCheck) + api.Get("/health", ctrl.healthCheck) + api.Get("/ready", ctrl.readinessCheck) return &Server{ app: app, @@ -61,13 +61,13 @@ type controller struct { logger *zap.Logger } -// NewController creates a Controller instance. -func NewController(checks []Check, logger *zap.Logger) *controller { +// newController creates a Controller instance. +func newController(checks []Check, logger *zap.Logger) *controller { return &controller{checks: checks, logger: logger} } -// HealthCheck is the HTTP handler for the route `GET /health`. -func (c *controller) HealthCheck(ctx *fiber.Ctx) error { +// healthCheck is the HTTP handler for the route `GET /health`. +func (c *controller) healthCheck(ctx *fiber.Ctx) error { response := ctx.JSON(struct { Status string `json:"status"` @@ -78,8 +78,8 @@ func (c *controller) HealthCheck(ctx *fiber.Ctx) error { return response } -// ReadinessCheck is the HTTP handler for the route `GET /ready`. -func (c *controller) ReadinessCheck(ctx *fiber.Ctx) error { +// readinessCheck is the HTTP handler for the route `GET /ready`. +func (c *controller) readinessCheck(ctx *fiber.Ctx) error { requestCtx := ctx.Context() requestID := fmt.Sprintf("%v", requestCtx.Value("requestid"))