Skip to content

Commit

Permalink
remove goconst and goimports
Browse files Browse the repository at this point in the history
remove goconst and goimports from golangci config. This also adds revive
latest config.

Signed-off-by: Anurag <anurag.kumar@syself.com>
  • Loading branch information
Anurag committed Dec 19, 2023
1 parent 25b8054 commit acde747
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 23 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ jobs:
# GIT_ACCESS_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
# run: make test-integration

# - name: Test Summary
# uses: test-summary/action@62bc5c68de2a6a0d02039763b8c754569df99e3f # v2.1
# with:
# paths: ".coverage/junit.xml"
# - name: Test Summary
# uses: test-summary/action@62bc5c68de2a6a0d02039763b8c754569df99e3f # v2.1
# with:
# paths: ".coverage/junit.xml"

# - name: Upload Report
# uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
# with:
# name: reports-${{ steps.name.outputs.name }}
# path: .reports
# retention-days: 30
# - name: Upload Report
# uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
# with:
# name: reports-${{ steps.name.outputs.name }}
# path: .reports
# retention-days: 30
8 changes: 6 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ linters:
- exportloopref
- forcetypeassert
- gci
- goconst
# - goconst
- gocritic
- godot
- gofmt
- gofumpt
- goimports
# - goimports
- goprintffuncname
- gosec
- gosimple
Expand Down Expand Up @@ -104,6 +104,10 @@ linters-settings:
revive:
enable-all-rules: true
rules:
- name: import-alias-naming
disabled: true
- name: redundant-import-alias
disabled: true
- name: dot-imports
disabled: true
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#add-constant
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ else
go version
golangci-lint version
golangci-lint run -v
cd $(TEST_DIR); golangci-lint run -v
# cd $(TEST_DIR); golangci-lint run -v
endif

.PHONY: lint-golang-ci
Expand Down
1 change: 0 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"

// 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"
Expand Down
2 changes: 1 addition & 1 deletion hack/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ version::get_version_vars() {
fi
fi

GIT_RELEASE_TAG=$(git describe --abbrev=0 --tags)
GIT_RELEASE_TAG=$(git describe --abbrev=0 --tags 2>/dev/null)
}

# borrowed from k8s.io/hack/lib/version.sh and modified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package controller
import (
"context"

infrastructureclusterstackxk8siov1alpha1 "github.com/sovereignCloudStack/cluster-stack-provider-openstack/api/v1alpha1"
infrav1alpha1 "github.com/sovereignCloudStack/cluster-stack-provider-openstack/api/v1alpha1"
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -48,6 +48,9 @@ type OpenstackClusterStackReleaseReconciler struct {
func (r *OpenstackClusterStackReleaseReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
_ = log.FromContext(ctx)

openstackclusterstackrelease := &infrav1alpha1.OpenstackClusterStackRelease{}
_ = r.Client.Get(ctx, req.NamespacedName, openstackclusterstackrelease)

// TODO(user): your logic here

return ctrl.Result{}, nil
Expand All @@ -56,6 +59,6 @@ func (r *OpenstackClusterStackReleaseReconciler) Reconcile(ctx context.Context,
// SetupWithManager sets up the controller with the Manager.
func (r *OpenstackClusterStackReleaseReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&infrastructureclusterstackxk8siov1alpha1.OpenstackClusterStackRelease{}).
For(&infrav1alpha1.OpenstackClusterStackRelease{}).
Complete(r)
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package controller
import (
"context"

infrastructureclusterstackxk8siov1alpha1 "github.com/sovereignCloudStack/cluster-stack-provider-openstack/api/v1alpha1"
infrav1alpha1 "github.com/sovereignCloudStack/cluster-stack-provider-openstack/api/v1alpha1"
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -48,14 +48,15 @@ type OpenstackClusterStackReleaseTemplateReconciler struct {
func (r *OpenstackClusterStackReleaseTemplateReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
_ = log.FromContext(ctx)

// TODO(user): your logic here
openstackclusterstackreleasetemplate := &infrav1alpha1.OpenstackClusterStackReleaseTemplate{}
_ = r.Client.Get(ctx, req.NamespacedName, openstackclusterstackreleasetemplate)

return ctrl.Result{}, nil
}

// SetupWithManager sets up the controller with the Manager.
func (r *OpenstackClusterStackReleaseTemplateReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&infrastructureclusterstackxk8siov1alpha1.OpenstackClusterStackReleaseTemplate{}).
For(&infrav1alpha1.OpenstackClusterStackReleaseTemplate{}).
Complete(r)
}
7 changes: 4 additions & 3 deletions internal/controller/openstacknodeimagerelease_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package controller
import (
"context"

infrastructureclusterstackxk8siov1alpha1 "github.com/sovereignCloudStack/cluster-stack-provider-openstack/api/v1alpha1"
infrav1alpha1 "github.com/sovereignCloudStack/cluster-stack-provider-openstack/api/v1alpha1"
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -49,14 +49,15 @@ type OpenstackNodeImageReleaseReconciler struct {
func (r *OpenstackNodeImageReleaseReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
_ = log.FromContext(ctx)

// TODO(user): your logic here
openstacknodeimagerelease := infrav1alpha1.OpenstackNodeImageRelease{}
_ = r.Client.Get(ctx, req.NamespacedName, &openstacknodeimagerelease)

return ctrl.Result{}, nil
}

// SetupWithManager sets up the controller with the Manager.
func (r *OpenstackNodeImageReleaseReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&infrastructureclusterstackxk8siov1alpha1.OpenstackNodeImageRelease{}).
For(&infrav1alpha1.OpenstackNodeImageRelease{}).
Complete(r)
}

0 comments on commit acde747

Please sign in to comment.