Skip to content

Commit 6ce4293

Browse files
committed
Fix linter warnings
Signed-off-by: Marco Franssen <[email protected]>
1 parent 5c16b46 commit 6ce4293

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+188
-170
lines changed

apis/fluentbit/v1alpha2/clusterfluentbitconfig_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,11 +550,11 @@ func (cfg ClusterFluentBitConfig) RenderNamespacedLuaScript(
550550
for _, f := range nsfilters.Items {
551551
for _, p := range f.Spec.FilterItems {
552552
if p.Lua != nil && p.Lua.Script.Key != "" {
553-
script, err := cl.LoadConfigMap(p.Lua.Script, f.ObjectMeta.Namespace)
553+
script, err := cl.LoadConfigMap(p.Lua.Script, f.Namespace)
554554
if err != nil {
555555
return nil, err
556556
}
557-
namespacedScriptName := fmt.Sprintf("%x-%s", md5.Sum([]byte(f.ObjectMeta.Namespace)), p.Lua.Script.Key)
557+
namespacedScriptName := fmt.Sprintf("%x-%s", md5.Sum([]byte(f.Namespace)), p.Lua.Script.Key)
558558
scripts = append(scripts, Script{Name: namespacedScriptName, Content: script})
559559
}
560560
}

apis/fluentbit/v1alpha2/collector_types.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,25 +114,25 @@ type Collector struct {
114114

115115
// IsBeingDeleted returns true if a deletion timestamp is set
116116
func (co *Collector) IsBeingDeleted() bool {
117-
return !co.ObjectMeta.DeletionTimestamp.IsZero()
117+
return !co.DeletionTimestamp.IsZero()
118118
}
119119

120120
// CollectorFinalizerName is the name of the fluentbit finalizer
121121
const CollectorFinalizerName = "collector.fluent.io"
122122

123123
// HasFinalizer returns true if the item has the specified finalizer
124124
func (co *Collector) HasFinalizer(finalizerName string) bool {
125-
return slices.Contains(co.ObjectMeta.Finalizers, finalizerName)
125+
return slices.Contains(co.Finalizers, finalizerName)
126126
}
127127

128128
// AddFinalizer adds the specified finalizer
129129
func (co *Collector) AddFinalizer(finalizerName string) {
130-
co.ObjectMeta.Finalizers = append(co.ObjectMeta.Finalizers, finalizerName)
130+
co.Finalizers = append(co.Finalizers, finalizerName)
131131
}
132132

133133
// RemoveFinalizer removes the specified finalizer
134134
func (co *Collector) RemoveFinalizer(finalizerName string) {
135-
co.ObjectMeta.Finalizers = slices.DeleteFunc(co.ObjectMeta.Finalizers, func(s string) bool { return s == finalizerName })
135+
co.Finalizers = slices.DeleteFunc(co.Finalizers, func(s string) bool { return s == finalizerName })
136136
}
137137

138138
// +kubebuilder:object:root=true

apis/fluentbit/v1alpha2/fluentbit_types.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,25 +142,25 @@ type FluentBit struct {
142142

143143
// IsBeingDeleted returns true if a deletion timestamp is set
144144
func (fb *FluentBit) IsBeingDeleted() bool {
145-
return !fb.ObjectMeta.DeletionTimestamp.IsZero()
145+
return !fb.DeletionTimestamp.IsZero()
146146
}
147147

148148
// FluentBitFinalizerName is the name of the fluentbit finalizer
149149
const FluentBitFinalizerName = "fluentbit.fluent.io"
150150

151151
// HasFinalizer returns true if the item has the specified finalizer
152152
func (fb *FluentBit) HasFinalizer(finalizerName string) bool {
153-
return slices.Contains(fb.ObjectMeta.Finalizers, finalizerName)
153+
return slices.Contains(fb.Finalizers, finalizerName)
154154
}
155155

156156
// AddFinalizer adds the specified finalizer
157157
func (fb *FluentBit) AddFinalizer(finalizerName string) {
158-
fb.ObjectMeta.Finalizers = append(fb.ObjectMeta.Finalizers, finalizerName)
158+
fb.Finalizers = append(fb.Finalizers, finalizerName)
159159
}
160160

161161
// RemoveFinalizer removes the specified finalizer
162162
func (fb *FluentBit) RemoveFinalizer(finalizerName string) {
163-
fb.ObjectMeta.Finalizers = slices.DeleteFunc(fb.ObjectMeta.Finalizers, func(s string) bool { return s == finalizerName })
163+
fb.Finalizers = slices.DeleteFunc(fb.Finalizers, func(s string) bool { return s == finalizerName })
164164
}
165165

166166
// +kubebuilder:object:root=true

apis/fluentbit/v1alpha2/plugins/common_types.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ type CommonParams struct {
1212

1313
// Alias for the plugin
1414
Alias string `json:"alias,omitempty"`
15-
// RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinetly. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1.
15+
// RetryLimit describes how many times fluent-bit should retry to send data to a specific output. If set to false fluent-bit will try indefinitely. If set to any integer N>0 it will try at most N+1 times. Leading zeros are not allowed (values such as 007, 0150, 01 do not work). If this property is not defined fluent-bit will use the default value: 1.
16+
// nolint:misspell
1617
// +kubebuilder:validation:Pattern="^(((f|F)alse)|(no_limits)|(no_retries)|([1-9]+[0-9]*))$"
1718
RetryLimit string `json:"retryLimit,omitempty"`
1819
}

apis/fluentbit/v1alpha2/plugins/configmap_types.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ package plugins
33
import (
44
"context"
55
"fmt"
6+
"strings"
7+
68
"github.com/go-openapi/errors"
7-
"k8s.io/api/core/v1"
9+
v1 "k8s.io/api/core/v1"
810
"sigs.k8s.io/controller-runtime/pkg/client"
9-
"strings"
1011
)
1112

1213
type ConfigMapLoader struct {
@@ -30,6 +31,6 @@ func (cl ConfigMapLoader) LoadConfigMap(selector v1.ConfigMapKeySelector, namesp
3031
if v, ok := configMap.Data[selector.Key]; !ok {
3132
return "", errors.NotFound(fmt.Sprintf("The key %s is not found.", selector.Key))
3233
} else {
33-
return strings.TrimSuffix(fmt.Sprintf("%s", v), "\n"), nil
34+
return strings.TrimSuffix(v, "\n"), nil
3435
}
3536
}

apis/fluentbit/v1alpha2/plugins/filter/lua_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (l *Lua) Params(_ plugins.SecretLoader) (*params.KVs, error) {
5555
}
5656

5757
if l.Code != "" {
58-
var singleLineLua string = ""
58+
var singleLineLua = ""
5959
lineTrim := ""
6060
for _, line := range strings.Split(strings.TrimSuffix(l.Code, "\n"), "\n") {
6161
lineTrim = strings.TrimSpace(line)
@@ -77,11 +77,11 @@ func (l *Lua) Params(_ plugins.SecretLoader) (*params.KVs, error) {
7777

7878
kvs.Insert("call", l.Call)
7979

80-
if l.TypeIntKey != nil && len(l.TypeIntKey) > 0 {
80+
if len(l.TypeIntKey) > 0 {
8181
kvs.Insert("type_int_key", strings.Join(l.TypeIntKey, " "))
8282
}
8383

84-
if l.TypeArrayKey != nil && len(l.TypeArrayKey) > 0 {
84+
if len(l.TypeArrayKey) > 0 {
8585
kvs.Insert("type_array_key", strings.Join(l.TypeArrayKey, " "))
8686
}
8787

apis/fluentbit/v1alpha2/plugins/filter/multiline_types.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ type Multiline struct {
1919

2020
type Multi struct {
2121
// Specify one or multiple Multiline Parsing definitions to apply to the content.
22-
//You can specify multiple multiline parsers to detect different formats by separating them with a comma.
22+
// You can specify multiple multiline parsers to detect different formats by separating them with a comma.
2323
Parser string `json:"parser"`
24-
//Key name that holds the content to process.
25-
//Note that a Multiline Parser definition can already specify the key_content to use, but this option allows to overwrite that value for the purpose of the filter.
24+
// Key name that holds the content to process.
25+
// Note that a Multiline Parser definition can already specify the key_content to use, but this option allows to overwrite that value for the purpose of the filter.
2626
KeyContent string `json:"keyContent,omitempty"`
2727
// +kubebuilder:validation:Enum:=parser;partial_message
2828
Mode string `json:"mode,omitempty"`
@@ -52,29 +52,29 @@ func (m *Multiline) Params(_ plugins.SecretLoader) (*params.KVs, error) {
5252
return kvs, err
5353
}
5454
if m.Multi != nil {
55-
if m.Multi.Parser != "" {
56-
kvs.Insert("multiline.parser", m.Multi.Parser)
55+
if m.Parser != "" {
56+
kvs.Insert("multiline.parser", m.Parser)
5757
}
58-
if m.Multi.KeyContent != "" {
59-
kvs.Insert("multiline.key_content", m.Multi.KeyContent)
58+
if m.KeyContent != "" {
59+
kvs.Insert("multiline.key_content", m.KeyContent)
6060
}
61-
if m.Multi.Mode != "" {
62-
kvs.Insert("mode", m.Multi.Mode)
61+
if m.Mode != "" {
62+
kvs.Insert("mode", m.Mode)
6363
}
64-
if m.Multi.Buffer != false {
65-
kvs.Insert("buffer", fmt.Sprint(m.Multi.Buffer))
64+
if m.Buffer {
65+
kvs.Insert("buffer", fmt.Sprint(m.Buffer))
6666
}
67-
if m.Multi.FlushMS != 0 {
68-
kvs.Insert("flush_ms", fmt.Sprint(m.Multi.FlushMS))
67+
if m.FlushMS != 0 {
68+
kvs.Insert("flush_ms", fmt.Sprint(m.FlushMS))
6969
}
70-
if m.Multi.EmitterName != "" {
71-
kvs.Insert("emitter_name", m.Multi.EmitterName)
70+
if m.EmitterName != "" {
71+
kvs.Insert("emitter_name", m.EmitterName)
7272
}
73-
if m.Multi.EmitterType != "" {
74-
kvs.Insert("emitter_storage.type", m.Multi.EmitterType)
73+
if m.EmitterType != "" {
74+
kvs.Insert("emitter_storage.type", m.EmitterType)
7575
}
76-
if m.Multi.EmitterMemBufLimit != 0 {
77-
kvs.Insert("emitter_mem_buf_limit", fmt.Sprintf("%dMB", m.Multi.EmitterMemBufLimit))
76+
if m.EmitterMemBufLimit != 0 {
77+
kvs.Insert("emitter_mem_buf_limit", fmt.Sprintf("%dMB", m.EmitterMemBufLimit))
7878
}
7979
}
8080
return kvs, nil

apis/fluentbit/v1alpha2/plugins/input/dummy_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
// It is useful for testing, debugging, benchmarking and getting started with Fluent Bit. <br />
1414
// **For full documentation, refer to https://docs.fluentbit.io/manual/pipeline/inputs/dummy**
1515
type Dummy struct {
16-
// Tag name associated to all records comming from this plugin.
16+
// Tag name associated to all records coming from this plugin.
1717
Tag string `json:"tag,omitempty"`
1818
// Dummy JSON record.
1919
Dummy string `json:"dummy,omitempty"`

apis/fluentbit/v1alpha2/plugins/input/forward.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
// +kubebuilder:object:generate:=true
1111

12-
// Forward defines the in_forward Input plugin that listens to TCP socket to recieve the event stream.
12+
// Forward defines the in_forward Input plugin that listens to TCP socket to receive the event stream.
1313
// **For full documentation, refer to https://docs.fluentbit.io/manual/pipeline/inputs/forward**
1414
type Forward struct {
1515
// Port for forward plugin instance.
@@ -22,11 +22,11 @@ type Forward struct {
2222
Tag string `json:"tag,omitempty"`
2323
// Adds the prefix to incoming event's tag
2424
TagPrefix string `json:"tagPrefix,omitempty"`
25-
// Specify the path to unix socket to recieve a forward message. If set, Listen and port are ignnored.
25+
// Specify the path to unix socket to receive a forward message. If set, Listen and port are ignnored.
2626
UnixPath string `json:"unixPath,omitempty"`
2727
// Set the permission of unix socket file.
2828
UnixPerm string `json:"unixPerm,omitempty"`
29-
// Specify maximum buffer memory size used to recieve a forward message.
29+
// Specify maximum buffer memory size used to receive a forward message.
3030
// The value must be according to the Unit Size specification.
3131
// +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$"
3232
BufferMaxSize string `json:"bufferMaxSize,omitempty"`

apis/fluentbit/v1alpha2/plugins/input/http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type HTTP struct {
3434
*plugins.TLS `json:"tls,omitempty"`
3535
}
3636

37-
func (_ *HTTP) Name() string {
37+
func (*HTTP) Name() string {
3838
return "http"
3939
}
4040

0 commit comments

Comments
 (0)