chore: update golangci-lint and fix all issues (#3575)

* chore: Update golangci-lint

Signed-off-by: Lars Francke <git@lars-francke.de>

* chore: fix all golangci-lint issues

- Remove deprecated `// +build` tags
- Fix godoclint, modernize, wsl_v5, govet, lll, gci, noctx issues
- Update linter configuration
- Modernize code to use Go 1.22+ features (for range N, slices.Contains, etc.)
- Update make check lint the privileged tests

Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com>

---------

Signed-off-by: Lars Francke <git@lars-francke.de>
Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com>
Co-authored-by: Lars Francke <git@lars-francke.de>
This commit is contained in:
Andrei Aaron
2025-11-22 23:36:48 +02:00
committed by GitHub
parent 566286ae42
commit da426850e7
242 changed files with 811 additions and 1010 deletions
+4 -4
View File
@@ -162,14 +162,14 @@ func (e *Event) Err(err error) *Event {
}
// Interface adds any interface field to the event.
func (e *Event) Interface(key string, val interface{}) *Event {
func (e *Event) Interface(key string, val any) *Event {
e.attrs = append(e.attrs, slog.Any(key, val))
return e
}
// Any adds any interface field to the event (alias for Interface).
func (e *Event) Any(key string, val interface{}) *Event {
func (e *Event) Any(key string, val any) *Event {
return e.Interface(key, val)
}
@@ -181,7 +181,7 @@ func (e *Event) Strs(key string, vals []string) *Event {
}
// IPAddr adds an IP address field to the event.
func (e *Event) IPAddr(key string, ip interface{}) *Event {
func (e *Event) IPAddr(key string, ip any) *Event {
e.attrs = append(e.attrs, slog.String(key, fmt.Sprintf("%v", ip)))
return e
@@ -214,7 +214,7 @@ func NewTestLoggerPtr() *Logger {
}
// Msgf logs the event with a formatted message.
func (e *Event) Msgf(format string, args ...interface{}) {
func (e *Event) Msgf(format string, args ...any) {
msg := fmt.Sprintf(format, args...)
// Create a new slice to avoid modifying the original
-1
View File
@@ -1,5 +1,4 @@
//go:build sync && scrub && metrics && search
// +build sync,scrub,metrics,search
package log_test