Skip to content

Commit

Permalink
Remove defer function again and enable next one
Browse files Browse the repository at this point in the history
Signed-off-by: Atanas Alexandrov <sirakov@gmail.com>
  • Loading branch information
cupakob committed Nov 5, 2024
1 parent 1193893 commit 59a7301
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions cmd/sharded-test-server/frontproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions cmd/sharded-test-server/virtual.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ func (v *VirtualWorkspace) start(ctx context.Context) error {
return err
}

logger := klog.FromContext(ctx)
defer func() {
err = logFile.Close()
if err != nil {
logger.Error(err, "failed to close the log file")
}
}()
// logger := klog.FromContext(ctx)
// defer func() {
// err = logFile.Close()
// if err != nil {
// logger.Error(err, "failed to close the log file")
// }
// }()

v.writer = helpers.NewHeadWriter(logFile, out)
cmd.Stdout = v.writer
Expand Down
12 changes: 6 additions & 6 deletions cmd/test-server/kcp/shard.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ func (s *Shard) Start(ctx context.Context, quiet bool) error {
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")
}
}()

s.writer = helpers.NewHeadWriter(logFile, out)
cmd.Stdout = s.writer
Expand Down

0 comments on commit 59a7301

Please sign in to comment.