From 4a36022e204bae87a06d34e2ea9232e7eac43f32 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 16 Jul 2023 22:35:44 +0200 Subject: [PATCH] log: WithLogger: remove redundant intermediate var Signed-off-by: Sebastiaan van Stijn --- log/context.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/log/context.go b/log/context.go index dbf967984..ab9f50132 100644 --- a/log/context.go +++ b/log/context.go @@ -103,8 +103,7 @@ func SetFormat(format string) error { // WithLogger returns a new context with the provided logger. Use in // combination with logger.WithField(s) for great effect. func WithLogger(ctx context.Context, logger *logrus.Entry) context.Context { - e := logger.WithContext(ctx) - return context.WithValue(ctx, loggerKey{}, e) + return context.WithValue(ctx, loggerKey{}, logger.WithContext(ctx)) } // GetLogger retrieves the current logger from the context. If no logger is