diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 832b91528..cb058b98b 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -7,7 +7,7 @@ on: env: GO_VERSION: '1.23' - GOLANGCI_LINT_VERSION: v1.62.0 + GOLANGCI_LINT_VERSION: v1.63.3 MISSPELL_VERSION: v0.6.0 jobs: diff --git a/.golangci.yml b/.golangci.yml index e7e82b5e9..c6e6b3b37 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -139,6 +139,9 @@ linters-settings: - name: unreachable-code - name: redefines-builtin-id gomoddirectives: + tool-forbidden: true + toolchain-pattern: 'go1\.\d+\.\d+$' + go-version-pattern: '^1\.\d+(\.0)?$' replace-allow-list: - github.com/abbot/go-http-auth - github.com/gorilla/mux diff --git a/cmd/traefik/traefik.go b/cmd/traefik/traefik.go index 12fa44344..00683f9fd 100644 --- a/cmd/traefik/traefik.go +++ b/cmd/traefik/traefik.go @@ -7,9 +7,11 @@ import ( "fmt" "io" stdlog "log" + "maps" "net/http" "os" "os/signal" + "slices" "sort" "strings" "syscall" @@ -48,7 +50,6 @@ import ( "github.com/traefik/traefik/v3/pkg/tracing" "github.com/traefik/traefik/v3/pkg/types" "github.com/traefik/traefik/v3/pkg/version" - "golang.org/x/exp/maps" ) func main() { @@ -230,8 +231,8 @@ func setupServer(staticConfiguration *static.Configuration) (*server.Server, err pluginLogger := log.Ctx(ctx).With().Logger() hasPlugins := staticConfiguration.Experimental != nil && (staticConfiguration.Experimental.Plugins != nil || staticConfiguration.Experimental.LocalPlugins != nil) if hasPlugins { - pluginsList := maps.Keys(staticConfiguration.Experimental.Plugins) - pluginsList = append(pluginsList, maps.Keys(staticConfiguration.Experimental.LocalPlugins)...) + pluginsList := slices.Collect(maps.Keys(staticConfiguration.Experimental.Plugins)) + pluginsList = append(pluginsList, slices.Collect(maps.Keys(staticConfiguration.Experimental.LocalPlugins))...) pluginLogger = pluginLogger.With().Strs("plugins", pluginsList).Logger() pluginLogger.Info().Msg("Loading plugins...") diff --git a/pkg/middlewares/accesslog/logger_test.go b/pkg/middlewares/accesslog/logger_test.go index 7f18bc188..9ebe2e020 100644 --- a/pkg/middlewares/accesslog/logger_test.go +++ b/pkg/middlewares/accesslog/logger_test.go @@ -820,7 +820,7 @@ func assertValidLogData(t *testing.T, expected string, logData []byte) { func captureStdout(t *testing.T) (out *os.File, restoreStdout func()) { t.Helper() - file, err := os.CreateTemp("", "testlogger") + file, err := os.CreateTemp(t.TempDir(), "testlogger") require.NoError(t, err, "failed to create temp file") original := os.Stdout diff --git a/pkg/muxer/http/matcher.go b/pkg/muxer/http/matcher.go index fb455803b..200f3fc5d 100644 --- a/pkg/muxer/http/matcher.go +++ b/pkg/muxer/http/matcher.go @@ -4,13 +4,13 @@ import ( "fmt" "net/http" "regexp" + "slices" "strings" "unicode/utf8" "github.com/rs/zerolog/log" "github.com/traefik/traefik/v3/pkg/ip" "github.com/traefik/traefik/v3/pkg/middlewares/requestdecorator" - "golang.org/x/exp/slices" ) var httpFuncs = map[string]func(*matchersTree, ...string) error{ diff --git a/pkg/provider/configuration.go b/pkg/provider/configuration.go index 9c2406acc..7fdba121c 100644 --- a/pkg/provider/configuration.go +++ b/pkg/provider/configuration.go @@ -3,7 +3,9 @@ package provider import ( "bytes" "context" + "maps" "reflect" + "slices" "sort" "strings" "text/template" @@ -14,7 +16,6 @@ import ( "github.com/traefik/traefik/v3/pkg/config/dynamic" "github.com/traefik/traefik/v3/pkg/logs" "github.com/traefik/traefik/v3/pkg/tls" - "golang.org/x/exp/maps" ) // Merge merges multiple configurations. @@ -423,7 +424,7 @@ func BuildTCPRouterConfiguration(ctx context.Context, configuration *dynamic.TCP if len(configuration.Services) > 1 { delete(configuration.Routers, routerName) loggerRouter.Error(). - Msgf("Router %s cannot be linked automatically with multiple Services: %q", routerName, maps.Keys(configuration.Services)) + Msgf("Router %s cannot be linked automatically with multiple Services: %q", routerName, slices.Collect(maps.Keys(configuration.Services))) continue } @@ -446,7 +447,7 @@ func BuildUDPRouterConfiguration(ctx context.Context, configuration *dynamic.UDP if len(configuration.Services) > 1 { delete(configuration.Routers, routerName) loggerRouter.Error(). - Msgf("Router %s cannot be linked automatically with multiple Services: %q", routerName, maps.Keys(configuration.Services)) + Msgf("Router %s cannot be linked automatically with multiple Services: %q", routerName, slices.Collect(maps.Keys(configuration.Services))) continue } @@ -494,7 +495,7 @@ func BuildRouterConfiguration(ctx context.Context, configuration *dynamic.HTTPCo if len(configuration.Services) > 1 { delete(configuration.Routers, routerName) loggerRouter.Error(). - Msgf("Router %s cannot be linked automatically with multiple Services: %q", routerName, maps.Keys(configuration.Services)) + Msgf("Router %s cannot be linked automatically with multiple Services: %q", routerName, slices.Collect(maps.Keys(configuration.Services))) continue }