Skip to content

Commit

Permalink
enable linters
Browse files Browse the repository at this point in the history
  • Loading branch information
kuritka committed Sep 12, 2024
1 parent d8bd2af commit 2f676e5
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 60 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/golagci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ jobs:
- name: GolangCI
uses: golangci/golangci-lint-action@v3
with:
version: v1.55.2
args: --timeout=3m
version: v1.61.0
args: --timeout=3m -c .golangci.toml
2 changes: 1 addition & 1 deletion .golangci.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ formats = "colored-line-number"
[linters]
enable = [
"gocyclo", "unconvert", "goimports", "unused",
"misspell", "nakedret", "errcheck", "revive", "ineffassign",
"misspell", "nakedret", "errcheck", "ineffassign",
"goconst", "govet", "unparam", "gofmt"
]

Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ toolchain go1.23.1

require (
k8s.io/apimachinery v0.31.0
k8s.io/component-base v0.31.0
k8s.io/klog/v2 v2.130.1
sigs.k8s.io/cluster-api v1.8.2
sigs.k8s.io/controller-runtime v0.19.0
sigs.k8s.io/external-dns v0.15.0
Expand Down Expand Up @@ -63,6 +61,7 @@ require (
k8s.io/api v0.31.0 // indirect
k8s.io/apiextensions-apiserver v0.31.0 // indirect
k8s.io/client-go v0.31.0 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f // indirect
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ k8s.io/apimachinery v0.31.0 h1:m9jOiSr3FoSSL5WO9bjm1n6B9KROYYgNZOb4tyZ1lBc=
k8s.io/apimachinery v0.31.0/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo=
k8s.io/client-go v0.31.0 h1:QqEJzNjbN2Yv1H79SsS+SWnXkBgVu4Pj3CJQgbx0gI8=
k8s.io/client-go v0.31.0/go.mod h1:Y9wvC76g4fLjmU0BA+rV+h2cncoadjvjjkkIGoTLcGU=
k8s.io/component-base v0.31.0 h1:/KIzGM5EvPNQcYgwq5NwoQBaOlVFrghoVGr8lG6vNRs=
k8s.io/component-base v0.31.0/go.mod h1:TYVuzI1QmN4L5ItVdMSXKvH7/DtvIuas5/mm8YT3rTo=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f h1:0LQagt0gDpKqvIkAMPaRGcXawNMouPECM1+F9BVxEaM=
Expand Down
94 changes: 42 additions & 52 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,63 +19,53 @@ Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic
*/

import (
"os"

epclient "github.com/absaoss/cap-infra-dns/pkg/client"

"github.com/absaoss/cap-infra-dns/pkg/controller"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/component-base/version"
"k8s.io/klog/v2"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"fmt"
)

var (
runtimeScheme = runtime.NewScheme()
setupLog = ctrl.Log.WithName("setup")
// runtimeScheme = runtime.NewScheme()
// setupLog = ctrl.Log.WithName("setup")
)

func init() {
utilruntime.Must(clusterv1.AddToScheme(runtimeScheme))
utilruntime.Must(epclient.AddToScheme(runtimeScheme))
}
//func init() {
// utilruntime.Must(clusterv1.AddToScheme(runtimeScheme))
// utilruntime.Must(epclient.AddToScheme(runtimeScheme))
//}

func main() {
ctrl.SetLogger(klog.Background())

ctx := ctrl.SetupSignalHandler()
opts := ctrl.Options{
Scheme: runtimeScheme,
}
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), opts)
if err != nil {
setupLog.Error(err, "unable to start manager")
os.Exit(1)
}

if err = (&controller.ClusterReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
}).SetupWithManager(ctx, mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "DNSEndpoint")
os.Exit(1)
}

if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
setupLog.Error(err, "unable to set up health check")
os.Exit(1)
}
if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil {
setupLog.Error(err, "unable to set up ready check")
os.Exit(1)
}

setupLog.Info("starting manager", "version", version.Get().String())
if err := mgr.Start(ctx); err != nil {
setupLog.Error(err, "problem running manager")
os.Exit(1)
}
fmt.Println("hello")
//ctrl.SetLogger(klog.Background())
//
//ctx := ctrl.SetupSignalHandler()
//opts := ctrl.Options{
// Scheme: runtimeScheme,
//}
//mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), opts)
//if err != nil {
// setupLog.Error(err, "unable to start manager")
// os.Exit(1)
//}
//
//if err = (&controller.ClusterReconciler{
// Client: mgr.GetClient(),
// Scheme: mgr.GetScheme(),
//}).SetupWithManager(ctx, mgr); err != nil {
// setupLog.Error(err, "unable to create controller", "controller", "DNSEndpoint")
// os.Exit(1)
//}
//
//if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
// setupLog.Error(err, "unable to set up health check")
// os.Exit(1)
//}
//if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil {
// setupLog.Error(err, "unable to set up ready check")
// os.Exit(1)
//}
//
//setupLog.Info("starting manager", "version", version.Get().String())
//if err := mgr.Start(ctx); err != nil {
// setupLog.Error(err, "problem running manager")
// os.Exit(1)
//}
}
5 changes: 4 additions & 1 deletion taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ tasks:
cmds:
- brew install gitleaks
- brew install yamllint
- brew install golangci-lint
# - brew install golangci-lint

Check warning on line 22 in taskfile.yaml

View workflow job for this annotation

GitHub Actions / YamlLint

22:1 [comments-indentation] comment not indented like content
# the program is in GO 1.23, whether you use `go install` or `brew install`,
# make sure that golangci-lint is >= v1.6.0
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0

0 comments on commit 2f676e5

Please sign in to comment.