From 431436b1c0debc0c91adaeb9fdde84ecb39def46 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 ++++++------ cmd/sharded-test-server/frontproxy.go | 12 ++++++------ 2 files changed, 12 insertions(+), 12 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 diff --git a/cmd/sharded-test-server/frontproxy.go b/cmd/sharded-test-server/frontproxy.go index b239d555d24..8dd572caa84 100644 --- a/cmd/sharded-test-server/frontproxy.go +++ b/cmd/sharded-test-server/frontproxy.go @@ -157,12 +157,12 @@ func startFrontProxy( return err } - // 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