Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: linters and central linter configuraton #344

Merged
merged 12 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 6 additions & 15 deletions .github/workflows/codequality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,9 @@ permissions:
pull-requests: read

jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.21"
cache: false
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.55
args: --timeout=5m
code-linter:
name: "Run golangci-lint"
uses: kyma-project/eventing-tools/.github/workflows/lint-go-reusable.yml@main
with:
go-version: "1.21"
the1bit marked this conversation as resolved.
Show resolved Hide resolved
lint-config-uri: https://raw.githubusercontent.com/kyma-project/eventing-tools/abb93fa301d4b1aa07b46e5b01ffb0463f06e1bb/config/lint/.golangci.yaml
242 changes: 0 additions & 242 deletions .golangci.yaml

This file was deleted.

21 changes: 10 additions & 11 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ import (
"flag"
"os"

// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
// to ensure that exec-entrypoint and run can make use of them.
_ "k8s.io/client-go/plugin/pkg/client/auth"

nmapiv1alpha1 "github.com/kyma-project/nats-manager/api/v1alpha1"
nmctrlcache "github.com/kyma-project/nats-manager/internal/controller/cache"
nmctrl "github.com/kyma-project/nats-manager/internal/controller/nats"
"github.com/kyma-project/nats-manager/pkg/env"
"github.com/kyma-project/nats-manager/pkg/k8s"
"github.com/kyma-project/nats-manager/pkg/k8s/chart"
nmmgr "github.com/kyma-project/nats-manager/pkg/manager"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
kapiextclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
Expand All @@ -37,13 +40,9 @@ import (
"sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"

nmapiv1alpha1 "github.com/kyma-project/nats-manager/api/v1alpha1"
nmctrlcache "github.com/kyma-project/nats-manager/internal/controller/cache"
nmctrl "github.com/kyma-project/nats-manager/internal/controller/nats"
"github.com/kyma-project/nats-manager/pkg/env"
"github.com/kyma-project/nats-manager/pkg/k8s"
"github.com/kyma-project/nats-manager/pkg/k8s/chart"
nmmgr "github.com/kyma-project/nats-manager/pkg/manager"
// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
// to ensure that exec-entrypoint and run can make use of them.
_ "k8s.io/client-go/plugin/pkg/client/auth"
)

const defaultMetricsPort = 9443
Expand Down
5 changes: 2 additions & 3 deletions e2e/common/fixtures/fixtures.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package fixtures

import (
nmapiv1alpha1 "github.com/kyma-project/nats-manager/api/v1alpha1"
"github.com/kyma-project/nats-manager/testutils"
kcorev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
kmetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

nmapiv1alpha1 "github.com/kyma-project/nats-manager/api/v1alpha1"
"github.com/kyma-project/nats-manager/testutils"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions e2e/common/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import (
"os"
"path/filepath"

nmapiv1alpha1 "github.com/kyma-project/nats-manager/api/v1alpha1"
"k8s.io/client-go/kubernetes"
kscheme "k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"sigs.k8s.io/controller-runtime/pkg/client"

nmapiv1alpha1 "github.com/kyma-project/nats-manager/api/v1alpha1"
)

func GetK8sClients() (*kubernetes.Clientset, client.Client, error) {
Expand Down
3 changes: 1 addition & 2 deletions internal/controller/cache/cache.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cache

import (
nmlabels "github.com/kyma-project/nats-manager/pkg/labels"
kappsv1 "k8s.io/api/apps/v1"
kautoscalingv1 "k8s.io/api/autoscaling/v1"
kcorev1 "k8s.io/api/core/v1"
Expand All @@ -10,8 +11,6 @@ import (
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"

nmlabels "github.com/kyma-project/nats-manager/pkg/labels"
)

// New returns a cache with the cache-options applied, generade form the rest-config.
Expand Down
10 changes: 4 additions & 6 deletions internal/controller/nats/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ import (
"context"
"fmt"

nmapiv1alpha1 "github.com/kyma-project/nats-manager/api/v1alpha1"
"github.com/kyma-project/nats-manager/pkg/events"
"github.com/kyma-project/nats-manager/pkg/k8s"
"github.com/kyma-project/nats-manager/pkg/k8s/chart"
nmmgr "github.com/kyma-project/nats-manager/pkg/manager"
nmnats "github.com/kyma-project/nats-manager/pkg/nats"

"go.uber.org/zap"
kappsv1 "k8s.io/api/apps/v1"
kcorev1 "k8s.io/api/core/v1"
Expand All @@ -34,11 +37,6 @@ import (
kcontrollerruntime "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller"

nmapiv1alpha1 "github.com/kyma-project/nats-manager/api/v1alpha1"
"github.com/kyma-project/nats-manager/pkg/k8s"
"github.com/kyma-project/nats-manager/pkg/k8s/chart"
nmmgr "github.com/kyma-project/nats-manager/pkg/manager"
)

const (
Expand Down
Loading
Loading