Skip to content

Commit

Permalink
Comment defer again
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 13, 2024
1 parent 97074e5 commit 8506642
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
20 changes: 9 additions & 11 deletions cmd/sharded-test-server/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ import (
"github.com/abiosoft/lineprefix"
"github.com/fatih/color"

"k8s.io/client-go/tools/clientcmd"
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
"k8s.io/klog/v2"

"github.com/kcp-dev/kcp/cmd/test-server/helpers"
kcpclientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster"
"github.com/kcp-dev/kcp/test/e2e/framework"
"k8s.io/client-go/tools/clientcmd"
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
)

func startCacheServer(ctx context.Context, logDirPath, workingDir string, syntheticDelay time.Duration) (<-chan error, string, error) {
Expand Down Expand Up @@ -73,13 +71,13 @@ func startCacheServer(ctx context.Context, logDirPath, workingDir string, synthe
return nil, "", 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")
// }
// }()

writer := helpers.NewHeadWriter(logFile, out)
cmd.Stdout = 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 8506642

Please sign in to comment.