Skip to content

Commit

Permalink
pkg,test: Fix linting violations in relevant packages
Browse files Browse the repository at this point in the history
Run find . -name '*.go' -not -path "./vendor/*" -not -path "./pkg/lib/operatorclient/operatorclientmocks/*" | xargs gofmt -w
find . -name '*.go' -not -path "./vendor/*" -not -path "./pkg/lib/operatorclient/operatorclientmocks/*" | xargs goimports -w and commit the results.

Signed-off-by: timflannagan <timflannagan@gmail.com>
  • Loading branch information
timflannagan committed Sep 8, 2021
1 parent 5deade0 commit 2246f8a
Show file tree
Hide file tree
Showing 17 changed files with 24 additions and 19 deletions.
4 changes: 2 additions & 2 deletions pkg/controller/certs/certs.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import (
)

type CertGenerator interface {
Generate(notAfter time.Time, organization string, ca *KeyPair, hosts []string) (*KeyPair, error)
Generate(notAfter time.Time, organization string, ca *KeyPair, hosts []string) (*KeyPair, error)
}

type CertGeneratorFunc func(notAfter time.Time, organization string, ca *KeyPair, hosts []string) (*KeyPair, error)

func (f CertGeneratorFunc) Generate(notAfter time.Time, organization string, ca *KeyPair, hosts []string) (*KeyPair, error) {
func (f CertGeneratorFunc) Generate(notAfter time.Time, organization string, ca *KeyPair, hosts []string) (*KeyPair, error) {
return f(notAfter, organization, ca, hosts)
}

Expand Down
1 change: 0 additions & 1 deletion pkg/controller/operators/catalog/installplan_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"


"github.com/sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package openshift

import (
"fmt"

semver "github.com/blang/semver/v4"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
operatorsv2 "github.com/operator-framework/api/pkg/operators/v2"
operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
operatorsv2 "github.com/operator-framework/api/pkg/operators/v2"
"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil"

appsv1 "k8s.io/api/apps/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
operatorsv2 "github.com/operator-framework/api/pkg/operators/v2"
operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
operatorsv2 "github.com/operator-framework/api/pkg/operators/v2"
)

var _ = Describe("The OperatorConditionsGenerator Controller", func() {
Expand Down
5 changes: 3 additions & 2 deletions pkg/controller/registry/grpc/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package grpc

import (
"context"
"github.com/operator-framework/operator-registry/pkg/client"
"sync"
"time"

"github.com/operator-framework/operator-registry/pkg/client"

"github.com/sirupsen/logrus"
"google.golang.org/grpc"
"google.golang.org/grpc/connectivity"
Expand Down Expand Up @@ -225,4 +226,4 @@ func (s *SourceStore) ClientsForNamespaces(namespaces ...string) map[registry.Ca

// TODO : remove unhealthy
return refs
}
}
2 changes: 1 addition & 1 deletion pkg/controller/registry/resolver/rbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func generateName(base string, o interface{}) string {
hashutil.DeepHashObject(hasher, o)
hash := utilrand.SafeEncodeString(fmt.Sprint(hasher.Sum32()))
if len(base)+len(hash) > maxNameLength {
base = base[:maxNameLength - len(hash) - 1]
base = base[:maxNameLength-len(hash)-1]
}

return fmt.Sprintf("%s-%s", base, hash)
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/registry/resolver/rbac_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ func TestGenerateName(t *testing.T) {
name: "generate",
args: args{
base: "myname",
o: []string{"something"},
o: []string{"something"},
},
want: "myname-9c895f74f",
},
{
name: "truncated",
args: args{
base: strings.Repeat("name", 100),
o: []string{"something", "else"},
o: []string{"something", "else"},
},
want: "namenamenamenamenamenamenamenamenamenamenamenamename-78fd8b4d6b",
},
Expand Down
3 changes: 2 additions & 1 deletion pkg/lib/controller-runtime/client/ssa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package client

import (
"context"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"testing"

"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"

"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/testobj"
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
Expand Down
1 change: 1 addition & 0 deletions pkg/lib/crd/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package crd

import (
"fmt"

apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
"k8s.io/apimachinery/pkg/runtime"
Expand Down
5 changes: 3 additions & 2 deletions pkg/lib/crd/storage_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package crd

import (
"testing"

"github.com/stretchr/testify/require"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"testing"
)

const crdName = "test"
Expand Down Expand Up @@ -152,4 +153,4 @@ func TestSafeStorageVersionUpgradeSuccess(t *testing.T) {
require.True(t, safe)
// expect no error, since crd upgrade is safe
require.NoError(t, err, "did not expect error for safe CRD upgrade")
}
}
1 change: 0 additions & 1 deletion pkg/lib/crd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ func Version(manifest *string) (string, error) {

return v, nil
}

2 changes: 1 addition & 1 deletion pkg/lib/operatorlister/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"sync"

"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/types"
Expand Down
2 changes: 1 addition & 1 deletion pkg/lib/operatorlister/operatorgroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/types"

"github.com/operator-framework/api/pkg/operators/v1"
v1 "github.com/operator-framework/api/pkg/operators/v1"
listers "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/lib/operatorlister/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"sync"

"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/types"
Expand Down
3 changes: 2 additions & 1 deletion pkg/package-server/provider/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry"
"io"
"strings"
"sync"
"time"

"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry"

"github.com/sirupsen/logrus"
"google.golang.org/grpc"
"google.golang.org/grpc/connectivity"
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package e2e
import (
"context"
"fmt"
"os/exec"

"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"os/exec"
)

// This module contains helper functions for copying images and creating image registries
Expand Down

0 comments on commit 2246f8a

Please sign in to comment.