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 d84b8d9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
19 changes: 9 additions & 10 deletions cmd/sharded-test-server/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"errors"
"fmt"
"k8s.io/klog/v2"
"net/http"
"os"
"os/exec"
Expand All @@ -30,13 +31,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 @@ -74,12 +73,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
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 d84b8d9

Please sign in to comment.