Skip to content

Commit

Permalink
convert bool to bool ptr in transfer Status
Browse files Browse the repository at this point in the history
This avoid defaulting bools to a value if unused.

Signed-off-by: Alay Patel <[email protected]>
  • Loading branch information
alaypatel07 committed Feb 20, 2022
1 parent e05191d commit 0a9737b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions transfer/rsync/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
rbacv1 "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
errorsutil "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/utils/pointer"
ctrlclient "sigs.k8s.io/controller-runtime/pkg/client"
ctrlutil "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
)
Expand Down Expand Up @@ -64,17 +65,17 @@ func (tc *client) Status(ctx context.Context, c ctrlclient.Client) (*transfer.St
if containerStatus.State.Terminated.ExitCode == 0 {
return &transfer.Status{
Completed: &transfer.Completed{
Successful: true,
Failure: false,
Successful: pointer.BoolPtr(true),
Failure: pointer.BoolPtr(false),
FinishedAt: &containerStatus.State.Terminated.FinishedAt,
},
}, nil
} else {
return &transfer.Status{
Running: nil,
Completed: &transfer.Completed{
Successful: false,
Failure: true,
Successful: pointer.Bool(false),
Failure: pointer.Bool(true),
FinishedAt: &containerStatus.State.Terminated.FinishedAt,
},
}, nil
Expand Down
4 changes: 2 additions & 2 deletions transfer/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ type Running struct {
}

type Completed struct {
Successful bool
Failure bool
Successful *bool
Failure *bool
FinishedAt *metav1.Time
}

Expand Down

0 comments on commit 0a9737b

Please sign in to comment.