Skip to content

Commit aad03f7

Browse files
fahedouchfahed dorgaamacedigital
authored
fix golangci-lint issues (zalando#2715)
Signed-off-by: fahed dorgaa <fahed.dorgaa@gmail.com> Co-authored-by: fahed dorgaa <fahed.dorgaa.ext@corp.ovh.com> Co-authored-by: Matthias Adler <macedigital@users.noreply.github.com>
1 parent 25ccc87 commit aad03f7

File tree

7 files changed

+7
-16
lines changed

7 files changed

+7
-16
lines changed

pkg/apis/acid.zalan.do/v1/postgresql_type.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ type Volume struct {
133133
Size string `json:"size"`
134134
StorageClass string `json:"storageClass,omitempty"`
135135
SubPath string `json:"subPath,omitempty"`
136-
IsSubPathExpr *bool `json:"isSubPathExpr,omitemtpy"`
136+
IsSubPathExpr *bool `json:"isSubPathExpr,omitempty"`
137137
Iops *int64 `json:"iops,omitempty"`
138138
Throughput *int64 `json:"throughput,omitempty"`
139139
VolumeType string `json:"type,omitempty"`
@@ -144,7 +144,7 @@ type AdditionalVolume struct {
144144
Name string `json:"name"`
145145
MountPath string `json:"mountPath"`
146146
SubPath string `json:"subPath,omitempty"`
147-
IsSubPathExpr *bool `json:"isSubPathExpr,omitemtpy"`
147+
IsSubPathExpr *bool `json:"isSubPathExpr,omitempty"`
148148
TargetContainers []string `json:"targetContainers"`
149149
VolumeSource v1.VolumeSource `json:"volumeSource"`
150150
}

pkg/cluster/cluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ func compareEnv(a, b []v1.EnvVar) bool {
668668
if len(a) != len(b) {
669669
return false
670670
}
671-
equal := true
671+
var equal bool
672672
for _, enva := range a {
673673
hasmatch := false
674674
for _, envb := range b {

pkg/cluster/exec.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/zalando/postgres-operator/pkg/util/constants"
1616
)
1717

18-
//ExecCommand executes arbitrary command inside the pod
18+
// ExecCommand executes arbitrary command inside the pod
1919
func (c *Cluster) ExecCommand(podName *spec.NamespacedName, command ...string) (string, error) {
2020
c.setProcessName("executing command %q", strings.Join(command, " "))
2121

@@ -59,7 +59,7 @@ func (c *Cluster) ExecCommand(podName *spec.NamespacedName, command ...string) (
5959
return "", fmt.Errorf("failed to init executor: %v", err)
6060
}
6161

62-
err = exec.Stream(remotecommand.StreamOptions{
62+
err = exec.StreamWithContext(context.TODO(), remotecommand.StreamOptions{
6363
Stdout: &execOut,
6464
Stderr: &execErr,
6565
Tty: false,

pkg/cluster/k8sres.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ const (
4747
operatorPort = 8080
4848
)
4949

50-
type pgUser struct {
51-
Password string `json:"password"`
52-
Options []string `json:"options"`
53-
}
54-
5550
type patroniDCS struct {
5651
TTL uint32 `json:"ttl,omitempty"`
5752
LoopWait uint32 `json:"loop_wait,omitempty"`

pkg/cluster/util.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,10 +449,6 @@ func (c *Cluster) _waitPodLabelsReady(anyReplica bool) error {
449449
return err
450450
}
451451

452-
func (c *Cluster) waitForAnyReplicaLabelReady() error {
453-
return c._waitPodLabelsReady(true)
454-
}
455-
456452
func (c *Cluster) waitForAllPodsLabelReady() error {
457453
return c._waitPodLabelsReady(false)
458454
}

pkg/controller/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (c *Controller) createOperatorCRD(desiredCrd *apiextv1.CustomResourceDefini
8080
c.logger.Infof("customResourceDefinition %q has been registered", crd.Name)
8181
}
8282

83-
return wait.Poll(c.config.CRDReadyWaitInterval, c.config.CRDReadyWaitTimeout, func() (bool, error) {
83+
return wait.PollUntilContextTimeout(context.TODO(), c.config.CRDReadyWaitInterval, c.config.CRDReadyWaitTimeout, false, func(ctx context.Context) (bool, error) {
8484
c, err := c.KubeClient.CustomResourceDefinitions().Get(context.TODO(), desiredCrd.Name, metav1.GetOptions{})
8585
if err != nil {
8686
return false, err

pkg/util/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const (
3535
var passwordChars = []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
3636

3737
func init() {
38-
rand.Seed(time.Now().Unix())
38+
rand.New(rand.NewSource(time.Now().Unix()))
3939
}
4040

4141
// helper function to get bool pointers

0 commit comments

Comments
 (0)