diff options
author | Igor Wiedler <iwiedler@gitlab.com> | 2021-01-06 14:47:42 +0300 |
---|---|---|
committer | Igor Wiedler <iwiedler@gitlab.com> | 2021-01-06 14:47:48 +0300 |
commit | a3055cd311d892d09194b8dedafeb0aa1297d5e5 (patch) | |
tree | 7d42f3876210fd0724dea6cbeb5e8c9dd9086df4 | |
parent | ca1583d8c8886cebfad74711dcfe9fc4a21d73a1 (diff) |
single-line stats extraction nil check
-rw-r--r-- | internal/middleware/commandstatshandler/commandstatshandler.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/internal/middleware/commandstatshandler/commandstatshandler.go b/internal/middleware/commandstatshandler/commandstatshandler.go index 13b27e20a..5deb8ac1a 100644 --- a/internal/middleware/commandstatshandler/commandstatshandler.go +++ b/internal/middleware/commandstatshandler/commandstatshandler.go @@ -47,8 +47,7 @@ func CommandStatsMessageProducer(ctx context.Context, format string, level logru entry := ctxlogrus.Extract(ctx).WithContext(ctx).WithFields(fields) // safely inject commandstats - stats := command.StatsFromContext(ctx) - if stats != nil { + if stats := command.StatsFromContext(ctx); stats != nil { entry = entry.WithFields(stats.Fields()) } |