Skip to content

Commit

Permalink
Bump golangci-lint & fix linter errors
Browse files Browse the repository at this point in the history
Signed-off-by: jesus m. rodriguez <jesusr@redhat.com>
  • Loading branch information
jmrodri committed Sep 3, 2022
1 parent baffadc commit 3d28851
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.29
version: v1.49
args: --timeout 5m

go-apidiff:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ clean: ## Clean up your working environment
@rm -f cover.out

GOLANGCI_LINT=./bin/golangci-lint
GOLANGCI_LINT_VER=1.30.0
GOLANGCI_LINT_VER=1.49.0
golangci-lint:
ifneq ($(GOLANGCI_LINT_VER), $(shell $(GOLANGCI_LINT) version 2>&1 | cut -d" " -f4))
@{ \
Expand Down
4 changes: 2 additions & 2 deletions handler/instrumented_enqueue_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ import (
// when create/update/delete events occur. These metrics contain the following
// information on resource.
//
// resource_created_at_seconds{"name", "namespace", "group", "version", "kind"}
// resource_created_at_seconds{"name", "namespace", "group", "version", "kind"}
//
// To call the handler use:
//
// &handler.InstrumentedEnqueueRequestForObject{}
// &handler.InstrumentedEnqueueRequestForObject{}
type InstrumentedEnqueueRequestForObject struct {
handler.EnqueueRequestForObject
}
Expand Down
3 changes: 1 addition & 2 deletions internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package utils

import (
"fmt"
"io/ioutil"
"os"
"strings"
)
Expand All @@ -26,7 +25,7 @@ import (
var ErrNoNamespace = fmt.Errorf("namespace not found for current environment")

var readSAFile = func() ([]byte, error) {
return ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace")
return os.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace")
}

// GetOperatorNamespace returns the namespace the operator should be running in from
Expand Down
4 changes: 2 additions & 2 deletions leader/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ You should run it configured with:
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
fieldRef:
fieldPath: metadata.name
*/
package leader
35 changes: 17 additions & 18 deletions predicate/nogeneration.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,25 @@ var _ predicate.Predicate = NoGenerationPredicate{}
// sigs.k8s.io/controller-runtime/pkg/predicate.GenerationChangedPredicate to allow update events on all potentially
// changed objects, those that respect Generation semantics or those that do not:
//
// import (
// corev1 "k8s.io/api/core/v1"
// appsv1 "k8s.io/api/apps/v1"
// ctrl "sigs.k8s.io/controller-runtime"
// "sigs.k8s.io/controller-runtime/pkg/event"
// ctrlpredicate "sigs.k8s.io/controller-runtime/pkg/predicate"
// libpredicate "github.com/operator-framework/operator-lib/predicate"
// import (
// corev1 "k8s.io/api/core/v1"
// appsv1 "k8s.io/api/apps/v1"
// ctrl "sigs.k8s.io/controller-runtime"
// "sigs.k8s.io/controller-runtime/pkg/event"
// ctrlpredicate "sigs.k8s.io/controller-runtime/pkg/predicate"
// libpredicate "github.com/operator-framework/operator-lib/predicate"
//
// "github.com/example/my-operator/api/v1alpha1"
// )
//
// func (r *MyTypeReconciler) SetupWithManager(mgr ctrl.Manager) error {
// return ctrl.NewControllerManagedBy(mgr).
// For(&v1alpha1.MyType{}).
// Owns(&corev1.Pod{}). // Does not respect Generation.
// Owns(&appsv1.Deployment{}). // Respects Generation.
// WithEventFilter(ctrlpredicate.Or(ctrlpredicate.GenerationChangedPredicate{}, libpredicate.NoGenerationPredicate{})).
// Complete(r)
// }
// "github.com/example/my-operator/api/v1alpha1"
// )
//
// func (r *MyTypeReconciler) SetupWithManager(mgr ctrl.Manager) error {
// return ctrl.NewControllerManagedBy(mgr).
// For(&v1alpha1.MyType{}).
// Owns(&corev1.Pod{}). // Does not respect Generation.
// Owns(&appsv1.Deployment{}). // Respects Generation.
// WithEventFilter(ctrlpredicate.Or(ctrlpredicate.GenerationChangedPredicate{}, libpredicate.NoGenerationPredicate{})).
// Complete(r)
// }
type NoGenerationPredicate struct {
predicate.Funcs
}
Expand Down

0 comments on commit 3d28851

Please sign in to comment.