chore: update linter

This commit is contained in:
Ludovic Fernandez 2024-02-19 15:44:03 +01:00 committed by GitHub
parent 1034646ae2
commit 88a2020817
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
57 changed files with 139 additions and 218 deletions

View file

@ -3,6 +3,7 @@ package tcpmiddleware
import (
"context"
"fmt"
"slices"
"strings"
"github.com/traefik/traefik/v2/pkg/config/runtime"
@ -74,7 +75,7 @@ func checkRecursion(ctx context.Context, middlewareName string) (context.Context
currentStack = []string{}
}
if inSlice(middlewareName, currentStack) {
if slices.Contains(currentStack, middlewareName) {
return ctx, fmt.Errorf("could not instantiate middleware %s: recursion detected in %s", middlewareName, strings.Join(append(currentStack, middlewareName), "->"))
}
@ -117,12 +118,3 @@ func (b *Builder) buildConstructor(ctx context.Context, middlewareName string) (
return middleware, nil
}
func inSlice(element string, stack []string) bool {
for _, value := range stack {
if value == element {
return true
}
}
return false
}