Skip to content

Commit bad20c9

Browse files
committed
Remove unnecessary type conversions
1 parent c9220bc commit bad20c9

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

.golangci.next.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ linters:
2323
- tenv
2424
- thelper
2525
- tparallel
26-
- unconvert
2726
- wastedassign
2827

2928
issues:

.golangci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ linters:
1212
- gosimple
1313
- importas
1414
- misspell
15+
- unconvert
1516
presets:
1617
- bugs
1718
- format

internal/controller/postgrescluster/patroni.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,14 +554,14 @@ func (r *Reconciler) reconcilePatroniSwitchover(ctx context.Context,
554554
// In the default case we will be using SwitchoverAndWait. This API call uses
555555
// a Patronictl switchover to move to the target instance.
556556
action := func(ctx context.Context, exec patroni.Executor, next string) (bool, error) {
557-
success, err := patroni.Executor(exec).SwitchoverAndWait(ctx, next)
557+
success, err := exec.SwitchoverAndWait(ctx, next)
558558
return success, errors.WithStack(err)
559559
}
560560

561561
if spec.Type == v1beta1.PatroniSwitchoverTypeFailover {
562562
// When a failover has been requested we use FailoverAndWait to change the primary.
563563
action = func(ctx context.Context, exec patroni.Executor, next string) (bool, error) {
564-
success, err := patroni.Executor(exec).FailoverAndWait(ctx, next)
564+
success, err := exec.FailoverAndWait(ctx, next)
565565
return success, errors.WithStack(err)
566566
}
567567
}

internal/controller/postgrescluster/pgbackrest_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ topologySpreadConstraints:
426426
"involvedObject.kind": "PostgresCluster",
427427
"involvedObject.name": clusterName,
428428
"involvedObject.namespace": ns.Name,
429-
"involvedObject.uid": string(clusterUID),
429+
"involvedObject.uid": clusterUID,
430430
"reason": "RepoHostCreated",
431431
}); err != nil {
432432
return false, err
@@ -739,7 +739,7 @@ func TestReconcileStanzaCreate(t *testing.T) {
739739
"involvedObject.kind": "PostgresCluster",
740740
"involvedObject.name": clusterName,
741741
"involvedObject.namespace": ns.Name,
742-
"involvedObject.uid": string(clusterUID),
742+
"involvedObject.uid": clusterUID,
743743
"reason": "StanzasCreated",
744744
}); err != nil {
745745
return false, err
@@ -783,7 +783,7 @@ func TestReconcileStanzaCreate(t *testing.T) {
783783
"involvedObject.kind": "PostgresCluster",
784784
"involvedObject.name": clusterName,
785785
"involvedObject.namespace": ns.Name,
786-
"involvedObject.uid": string(clusterUID),
786+
"involvedObject.uid": clusterUID,
787787
"reason": "UnableToCreateStanzas",
788788
}); err != nil {
789789
return false, err

internal/pgbackrest/pgbackrest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fi
8989
// if the err returned from pgbackrest command is about a version mismatch
9090
// then we should run upgrade rather than create
9191
if strings.Contains(errReturn, errMsgBackupDbMismatch) {
92-
return Executor(exec).StanzaCreateOrUpgrade(ctx, configHash, true)
92+
return exec.StanzaCreateOrUpgrade(ctx, configHash, true)
9393
}
9494

9595
// if none of the above errors, return the err

0 commit comments

Comments
 (0)