From e9bbd581666ff300c7a5e055856e812644a4f20f Mon Sep 17 00:00:00 2001 From: Kristof Kowalski Date: Tue, 26 Jul 2022 21:48:37 +1000 Subject: [PATCH] Errcheck logger --- internal/cli/cli.go | 4 ++-- internal/cli/traces.go | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/cli/cli.go b/internal/cli/cli.go index b90769b..b973503 100644 --- a/internal/cli/cli.go +++ b/internal/cli/cli.go @@ -24,12 +24,12 @@ func initLogger(c *cli.Context) error { cfg = zap.NewProductionConfig() } logger, err = cfg.Build() - - defer logger.Sync() if err != nil { panic(err) } + defer logger.Sync() + return err } diff --git a/internal/cli/traces.go b/internal/cli/traces.go index 2c607d8..425b84f 100644 --- a/internal/cli/traces.go +++ b/internal/cli/traces.go @@ -152,7 +152,6 @@ func genTracesCommand() *cli.Command { }, Action: func(c *cli.Context) error { var err error - defer logger.Sync() if c.String("otel-exporter-otlp-endpoint") == "" { return errors.New("'otel-exporter-otlp-endpoint' must be set")