From 8495fac13850eb86714f996ab87021ce9fb3c1be Mon Sep 17 00:00:00 2001 From: MakMuftic Date: Wed, 13 Mar 2024 14:03:42 +0100 Subject: [PATCH] handle error lint fix --- main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 2147e1c..9c5e369 100644 --- a/main.go +++ b/main.go @@ -73,7 +73,12 @@ func main() { metricsServer := metrics.NewServer(metrics.Config{Port: uint(config.Metrics.Port)}) go func() { err = metricsServer.Start() - defer metricsServer.Stop() + defer func(metricsServer *metrics.Server) { + err := metricsServer.Stop() + if err != nil { + fmt.Fprintf(os.Stderr, "error stopping metrics server: %v\n", err) + } + }(metricsServer) if err != nil { fmt.Fprintf(os.Stderr, "error starting metrics server: %v\n", err) }