Skip to content

Commit 3d28851

Browse files
committed
Bump golangci-lint & fix linter errors
Signed-off-by: jesus m. rodriguez <[email protected]>
1 parent baffadc commit 3d28851

File tree

6 files changed

+24
-26
lines changed

6 files changed

+24
-26
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
- name: Run golangci-lint
5353
uses: golangci/golangci-lint-action@v3
5454
with:
55-
version: v1.29
55+
version: v1.49
5656
args: --timeout 5m
5757

5858
go-apidiff:

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ clean: ## Clean up your working environment
3535
@rm -f cover.out
3636

3737
GOLANGCI_LINT=./bin/golangci-lint
38-
GOLANGCI_LINT_VER=1.30.0
38+
GOLANGCI_LINT_VER=1.49.0
3939
golangci-lint:
4040
ifneq ($(GOLANGCI_LINT_VER), $(shell $(GOLANGCI_LINT) version 2>&1 | cut -d" " -f4))
4141
@{ \

handler/instrumented_enqueue_object.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ import (
2929
// when create/update/delete events occur. These metrics contain the following
3030
// information on resource.
3131
//
32-
// resource_created_at_seconds{"name", "namespace", "group", "version", "kind"}
32+
// resource_created_at_seconds{"name", "namespace", "group", "version", "kind"}
3333
//
3434
// To call the handler use:
3535
//
36-
// &handler.InstrumentedEnqueueRequestForObject{}
36+
// &handler.InstrumentedEnqueueRequestForObject{}
3737
type InstrumentedEnqueueRequestForObject struct {
3838
handler.EnqueueRequestForObject
3939
}

internal/utils/utils.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package utils
1616

1717
import (
1818
"fmt"
19-
"io/ioutil"
2019
"os"
2120
"strings"
2221
)
@@ -26,7 +25,7 @@ import (
2625
var ErrNoNamespace = fmt.Errorf("namespace not found for current environment")
2726

2827
var readSAFile = func() ([]byte, error) {
29-
return ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace")
28+
return os.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace")
3029
}
3130

3231
// GetOperatorNamespace returns the namespace the operator should be running in from

leader/doc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ You should run it configured with:
4848
env:
4949
- name: POD_NAME
5050
valueFrom:
51-
fieldRef:
52-
fieldPath: metadata.name
51+
fieldRef:
52+
fieldPath: metadata.name
5353
*/
5454
package leader

predicate/nogeneration.go

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,25 @@ var _ predicate.Predicate = NoGenerationPredicate{}
3333
// sigs.k8s.io/controller-runtime/pkg/predicate.GenerationChangedPredicate to allow update events on all potentially
3434
// changed objects, those that respect Generation semantics or those that do not:
3535
//
36-
// import (
37-
// corev1 "k8s.io/api/core/v1"
38-
// appsv1 "k8s.io/api/apps/v1"
39-
// ctrl "sigs.k8s.io/controller-runtime"
40-
// "sigs.k8s.io/controller-runtime/pkg/event"
41-
// ctrlpredicate "sigs.k8s.io/controller-runtime/pkg/predicate"
42-
// libpredicate "github.com/operator-framework/operator-lib/predicate"
36+
// import (
37+
// corev1 "k8s.io/api/core/v1"
38+
// appsv1 "k8s.io/api/apps/v1"
39+
// ctrl "sigs.k8s.io/controller-runtime"
40+
// "sigs.k8s.io/controller-runtime/pkg/event"
41+
// ctrlpredicate "sigs.k8s.io/controller-runtime/pkg/predicate"
42+
// libpredicate "github.com/operator-framework/operator-lib/predicate"
4343
//
44-
// "github.com/example/my-operator/api/v1alpha1"
45-
// )
46-
//
47-
// func (r *MyTypeReconciler) SetupWithManager(mgr ctrl.Manager) error {
48-
// return ctrl.NewControllerManagedBy(mgr).
49-
// For(&v1alpha1.MyType{}).
50-
// Owns(&corev1.Pod{}). // Does not respect Generation.
51-
// Owns(&appsv1.Deployment{}). // Respects Generation.
52-
// WithEventFilter(ctrlpredicate.Or(ctrlpredicate.GenerationChangedPredicate{}, libpredicate.NoGenerationPredicate{})).
53-
// Complete(r)
54-
// }
44+
// "github.com/example/my-operator/api/v1alpha1"
45+
// )
5546
//
47+
// func (r *MyTypeReconciler) SetupWithManager(mgr ctrl.Manager) error {
48+
// return ctrl.NewControllerManagedBy(mgr).
49+
// For(&v1alpha1.MyType{}).
50+
// Owns(&corev1.Pod{}). // Does not respect Generation.
51+
// Owns(&appsv1.Deployment{}). // Respects Generation.
52+
// WithEventFilter(ctrlpredicate.Or(ctrlpredicate.GenerationChangedPredicate{}, libpredicate.NoGenerationPredicate{})).
53+
// Complete(r)
54+
// }
5655
type NoGenerationPredicate struct {
5756
predicate.Funcs
5857
}

0 commit comments

Comments
 (0)