Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Run linter
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: v2.11.4
version: v2.13.2

actionlint:
name: Lint GitHub Actions workflows
Expand Down
5 changes: 5 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ linters:
- unused

settings:
goconst:
min-occurrences: 10
revive:
rules:
- name: comment-spacings
Expand All @@ -42,6 +44,9 @@ linters:
- dupl
- lll
path: internal/*
- linters:
- goconst
path: _test\.go
- linters:
- misspell
path: apis/fluentbit/v1alpha2/plugins/common_types.go
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ CONTROLLER_TOOLS_VERSION ?= v0.18.0
ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-%d.%d", $$2, $$3}')
#ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31)
ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d", $$3}')
GOLANGCI_LINT_VERSION ?= v2.6.2
GOLANGCI_LINT_VERSION ?= v2.13.2
GINKGO_VERSION ?= v2.27.2
CODE_GENERATOR_VERSION ?= v0.32.3
KIND_VERSION ?= v0.30.0
Expand Down
8 changes: 4 additions & 4 deletions apis/fluentbit/v1alpha2/clusterfilter_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ func (list ClusterFilterList) Load(sl plugins.SecretLoader) (string, error) {
}

for _, elem := range item.Spec.FilterItems {
for i := 0; i < reflect.ValueOf(elem).NumField(); i++ {
p, _ := reflect.ValueOf(elem).Field(i).Interface().(plugins.Plugin)
for _, field := range reflect.ValueOf(elem).Fields() {
p, _ := field.Interface().(plugins.Plugin)
if err := merge(p); err != nil {
return "", err
}
Expand Down Expand Up @@ -224,8 +224,8 @@ func (list ClusterFilterList) LoadAsYaml(sl plugins.SecretLoader, depth int) (st
}

for _, elem := range item.Spec.FilterItems {
for i := 0; i < reflect.ValueOf(elem).NumField(); i++ {
p, _ := reflect.ValueOf(elem).Field(i).Interface().(plugins.Plugin)
for _, field := range reflect.ValueOf(elem).Fields() {
p, _ := field.Interface().(plugins.Plugin)
if err := merge(p); err != nil {
return "", err
}
Expand Down
29 changes: 14 additions & 15 deletions apis/fluentbit/v1alpha2/clusterfilter_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

"github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins"
"github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/filter"
"github.com/fluent/fluent-operator/v3/pkg/utils"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down Expand Up @@ -136,11 +135,11 @@ func TestClusterFilterList_Load(t *testing.T) {
KubeURL: "http://127.0.0.1:6443",
KubeCAFile: "root.ca",
KubeCAPath: "/root/.kube/crt",
Labels: utils.ToPtr(true),
Annotations: utils.ToPtr(true),
DNSWaitTime: utils.ToPtr[int32](30),
UseKubelet: utils.ToPtr(true),
KubeletPort: utils.ToPtr[int32](10000),
Labels: new(true),
Annotations: new(true),
DNSWaitTime: new(int32(30)),
UseKubelet: new(true),
KubeletPort: new(int32(10000)),
KubeMetaCacheTTL: "60s",
},
},
Expand All @@ -164,8 +163,8 @@ func TestClusterFilterList_Load(t *testing.T) {
CommonParams: plugins.CommonParams{
Alias: "throttle.application-xy",
},
Rate: utils.ToPtr[int64](200),
Window: utils.ToPtr[int64](300),
Rate: new(int64(200)),
Window: new(int64(300)),
Interval: "1s",
},
},
Expand Down Expand Up @@ -622,11 +621,11 @@ func TestClusterFilterList_Load_As_Yaml(t *testing.T) {
KubeURL: "http://127.0.0.1:6443",
KubeCAFile: "root.ca",
KubeCAPath: "/root/.kube/crt",
Labels: utils.ToPtr(true),
Annotations: utils.ToPtr(true),
DNSWaitTime: utils.ToPtr[int32](30),
UseKubelet: utils.ToPtr(true),
KubeletPort: utils.ToPtr[int32](10000),
Labels: new(true),
Annotations: new(true),
DNSWaitTime: new(int32(30)),
UseKubelet: new(true),
KubeletPort: new(int32(10000)),
KubeMetaCacheTTL: "60s",
},
},
Expand All @@ -650,8 +649,8 @@ func TestClusterFilterList_Load_As_Yaml(t *testing.T) {
CommonParams: plugins.CommonParams{
Alias: "throttle.application-xy",
},
Rate: utils.ToPtr[int64](200),
Window: utils.ToPtr[int64](300),
Rate: new(int64(200)),
Window: new(int64(300)),
Interval: "1s",
},
},
Expand Down
Loading
Loading