From f0e16250d9af7d10d2e82f39c67745114588b884 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 16 Oct 2023 22:11:30 +0200 Subject: [PATCH] fixed linting issues --- server/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/main.go b/server/main.go index 75a49da5..01b65ca0 100644 --- a/server/main.go +++ b/server/main.go @@ -124,14 +124,14 @@ func main() { func UnaryRequestLogger(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { start := time.Now() resp, err := handler(ctx, req) - fields := log.Fields{"elapsed": time.Now().Sub(start)} + fields := log.Fields{"elapsed": time.Since(start)} log.WithContext(ctx).WithFields(fields).WithError(err).Info(info.FullMethod) return resp, err } func StreamRequestLogger(srv any, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { start := time.Now() err := handler(srv, stream) - log.WithField("elapsed", time.Now().Sub(start)).WithError(err).Info(info.FullMethod) + log.WithField("elapsed", time.Since(start)).WithError(err).Info(info.FullMethod) return err }