Skip to content

Commit

Permalink
fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Disper committed Sep 12, 2023
1 parent d9be2a5 commit c31ad77
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 28 deletions.
6 changes: 3 additions & 3 deletions api/v1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ import (

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "clusterinventory.kyma-project.io", Version: "v1"}
GroupVersion = schema.GroupVersion{Group: "clusterinventory.kyma-project.io", Version: "v1"} //nolint:gochecknoglobals

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} //nolint:gochecknoglobals

// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
AddToScheme = SchemeBuilder.AddToScheme //nolint:gochecknoglobals
)
19 changes: 8 additions & 11 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,22 @@ 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"

clusterinventoryv1 "github.com/kyma-project/cluster-inventory/api/v1"
"github.com/kyma-project/cluster-inventory/internal/controller"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"

Check failure on line 27 in cmd/main.go

View workflow job for this annotation

GitHub Actions / lint

File is not `goimports`-ed (goimports)
// 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"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

clusterinventoryv1 "github.com/kyma-project/cluster-inventory/api/v1"
"github.com/kyma-project/cluster-inventory/internal/controller"
//+kubebuilder:scaffold:imports
)

var (
scheme = runtime.NewScheme()
setupLog = ctrl.Log.WithName("setup")
scheme = runtime.NewScheme() //nolint:gochecknoglobals
setupLog = ctrl.Log.WithName("setup") //nolint:gochecknoglobals
)

func init() {
Expand Down Expand Up @@ -68,7 +65,7 @@ func main() {
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
Port: 9443, //nolint:gomnd
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "f1c68560.kyma-project.io",
Expand Down
9 changes: 4 additions & 5 deletions internal/controller/cluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ package controller
import (
"context"

clusterinventoryv1 "github.com/kyma-project/cluster-inventory/api/v1"
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"

clusterinventoryv1 "github.com/kyma-project/cluster-inventory/api/v1"
)

// ClusterReconciler reconciles a Cluster object
Expand All @@ -39,17 +38,17 @@ type ClusterReconciler struct {

// Reconcile is part of the main kubernetes reconciliation loop which aims to
// move the current state of the cluster closer to the desired state.
// TODO(user): Modify the Reconcile function to compare the state specified by
// nolint:all TODO(user): Modify the Reconcile function to compare the state specified by
// the Cluster object against the actual cluster state, and then
// perform operations to make the cluster state reflect the state specified by
// the user.
//
// For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.15.0/pkg/reconcile
func (r *ClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
func (r *ClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { //nolint:revive
_ = log.FromContext(ctx)

// TODO(user): your logic here
// nolint:all TODO(user): your logic here

return ctrl.Result{}, nil
}
Expand Down
11 changes: 4 additions & 7 deletions internal/controller/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,23 @@ import (
"path/filepath"
"testing"

clusterinventoryv1 "github.com/kyma-project/cluster-inventory/api/v1"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

clusterinventoryv1 "github.com/kyma-project/cluster-inventory/api/v1"
//+kubebuilder:scaffold:imports
)

// These tests use Ginkgo (BDD-style Go testing framework). Refer to
// http://onsi.github.io/ginkgo/ to learn more about Ginkgo.

var cfg *rest.Config
var k8sClient client.Client
var testEnv *envtest.Environment
var cfg *rest.Config //nolint:gochecknoglobals
var k8sClient client.Client //nolint:gochecknoglobals
var testEnv *envtest.Environment //nolint:gochecknoglobals

func TestControllers(t *testing.T) {
RegisterFailHandler(Fail)
Expand Down
3 changes: 2 additions & 1 deletion pkg/provisioning/dynamic_kubeconfigs_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package provisioning

import (
"github.com/stretchr/testify/require"
"testing"

"github.com/stretchr/testify/require"
)

func TestDynamicKubeconfig(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/reconciler/verify_reconciler_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package provisioning

import (
"github.com/stretchr/testify/require"
"testing"

"github.com/stretchr/testify/require"
)

func TestReconciler(t *testing.T) {
Expand Down

0 comments on commit c31ad77

Please sign in to comment.