Skip to content

Commit

Permalink
fix golangci-lint issues (#2715)
Browse files Browse the repository at this point in the history
Signed-off-by: fahed dorgaa <[email protected]>
Co-authored-by: fahed dorgaa <[email protected]>
Co-authored-by: Matthias Adler <[email protected]>
  • Loading branch information
3 people authored Aug 14, 2024
1 parent 25ccc87 commit aad03f7
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 16 deletions.
4 changes: 2 additions & 2 deletions pkg/apis/acid.zalan.do/v1/postgresql_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ type Volume struct {
Size string `json:"size"`
StorageClass string `json:"storageClass,omitempty"`
SubPath string `json:"subPath,omitempty"`
IsSubPathExpr *bool `json:"isSubPathExpr,omitemtpy"`
IsSubPathExpr *bool `json:"isSubPathExpr,omitempty"`
Iops *int64 `json:"iops,omitempty"`
Throughput *int64 `json:"throughput,omitempty"`
VolumeType string `json:"type,omitempty"`
Expand All @@ -144,7 +144,7 @@ type AdditionalVolume struct {
Name string `json:"name"`
MountPath string `json:"mountPath"`
SubPath string `json:"subPath,omitempty"`
IsSubPathExpr *bool `json:"isSubPathExpr,omitemtpy"`
IsSubPathExpr *bool `json:"isSubPathExpr,omitempty"`
TargetContainers []string `json:"targetContainers"`
VolumeSource v1.VolumeSource `json:"volumeSource"`
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ func compareEnv(a, b []v1.EnvVar) bool {
if len(a) != len(b) {
return false
}
equal := true
var equal bool
for _, enva := range a {
hasmatch := false
for _, envb := range b {
Expand Down
4 changes: 2 additions & 2 deletions pkg/cluster/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/zalando/postgres-operator/pkg/util/constants"
)

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

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

err = exec.Stream(remotecommand.StreamOptions{
err = exec.StreamWithContext(context.TODO(), remotecommand.StreamOptions{
Stdout: &execOut,
Stderr: &execErr,
Tty: false,
Expand Down
5 changes: 0 additions & 5 deletions pkg/cluster/k8sres.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ const (
operatorPort = 8080
)

type pgUser struct {
Password string `json:"password"`
Options []string `json:"options"`
}

type patroniDCS struct {
TTL uint32 `json:"ttl,omitempty"`
LoopWait uint32 `json:"loop_wait,omitempty"`
Expand Down
4 changes: 0 additions & 4 deletions pkg/cluster/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,10 +449,6 @@ func (c *Cluster) _waitPodLabelsReady(anyReplica bool) error {
return err
}

func (c *Cluster) waitForAnyReplicaLabelReady() error {
return c._waitPodLabelsReady(true)
}

func (c *Cluster) waitForAllPodsLabelReady() error {
return c._waitPodLabelsReady(false)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (c *Controller) createOperatorCRD(desiredCrd *apiextv1.CustomResourceDefini
c.logger.Infof("customResourceDefinition %q has been registered", crd.Name)
}

return wait.Poll(c.config.CRDReadyWaitInterval, c.config.CRDReadyWaitTimeout, func() (bool, error) {
return wait.PollUntilContextTimeout(context.TODO(), c.config.CRDReadyWaitInterval, c.config.CRDReadyWaitTimeout, false, func(ctx context.Context) (bool, error) {
c, err := c.KubeClient.CustomResourceDefinitions().Get(context.TODO(), desiredCrd.Name, metav1.GetOptions{})
if err != nil {
return false, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const (
var passwordChars = []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")

func init() {
rand.Seed(time.Now().Unix())
rand.New(rand.NewSource(time.Now().Unix()))
}

// helper function to get bool pointers
Expand Down

0 comments on commit aad03f7

Please sign in to comment.