From 6356b7c4a9c49ba1053dbe98998189802b6b1cfc Mon Sep 17 00:00:00 2001 From: Atanas Alexandrov Date: Tue, 5 Nov 2024 09:38:53 +0100 Subject: [PATCH] Add first defer function Signed-off-by: Atanas Alexandrov --- cmd/sharded-test-server/cache.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/sharded-test-server/cache.go b/cmd/sharded-test-server/cache.go index 75466c16c63..11385bc630b 100644 --- a/cmd/sharded-test-server/cache.go +++ b/cmd/sharded-test-server/cache.go @@ -74,12 +74,12 @@ func startCacheServer(ctx context.Context, logDirPath, workingDir string, synthe } logger := klog.FromContext(ctx) - // defer func() { - // err = logFile.Close() - // if err != nil { - // logger.Error(err, "failed to close the log file") - // } - // }() + defer func() { + err = logFile.Close() + if err != nil { + logger.Error(err, "failed to close the log file") + } + }() writer := helpers.NewHeadWriter(logFile, out) cmd.Stdout = writer