diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 22ef2fc08..d9ded0f01 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,7 +12,7 @@ on: env: GO_VERSION: "1.22.3" - GOLANGCI_LINT_VERSION: "v1.57.2" + GOLANGCI_LINT_VERSION: "v1.59.0" HELM_VERSION: "3.14.1" KUBECONFORM_VERSION: "0.6.4" KUBERNETES_API_VERSION: "1.27.0" diff --git a/.golangci.yaml b/.golangci.yaml index 8c9c58448..4d7d81e45 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -10,23 +10,15 @@ linters: - wrapcheck - ireturn - exhaustruct - - exhaustivestruct - testpackage - paralleltest - nolintlint - tparallel - depguard - zerologlint - # deprecated - - interfacer - - varcheck - - deadcode - - nosnakecase - - structcheck - - maligned - - scopelint - - ifshort - - golint + # depricated + - gomnd + - execinquery issues: exclude-rules: @@ -36,9 +28,11 @@ issues: - maintidx - cyclop - gocognit - - goerr113 + - err113 - lll - errcheck + - canonicalheader + - mnd linters-settings: exhaustive: @@ -83,3 +77,8 @@ linters-settings: # to avoid having a CVE in the used version - golang.org/x/net - golang.org/x/text + mnd: + ignored-functions: + - '^make' + - '^math\.' + - '^time\.*' diff --git a/cmd/validate/ruleset.go b/cmd/validate/ruleset.go index b1b5cfbf4..14d26077a 100644 --- a/cmd/validate/ruleset.go +++ b/cmd/validate/ruleset.go @@ -18,6 +18,7 @@ package validate import ( "context" + "errors" "os" "github.com/rs/zerolog" @@ -31,6 +32,8 @@ import ( "github.com/dadrus/heimdall/internal/rules/rule" ) +var errFunctionNotSupported = errors.New("function not supported") + // NewValidateRulesCommand represents the "validate rules" command. func NewValidateRulesCommand() *cobra.Command { cmd := &cobra.Command{ @@ -99,7 +102,9 @@ func validateRuleSet(cmd *cobra.Command, args []string) error { type noopRepository struct{} -func (*noopRepository) FindRule(_ heimdall.Context) (rule.Rule, error) { return nil, nil } -func (*noopRepository) AddRuleSet(_ string, _ []rule.Rule) error { return nil } -func (*noopRepository) UpdateRuleSet(_ string, _ []rule.Rule) error { return nil } -func (*noopRepository) DeleteRuleSet(_ string) error { return nil } +func (*noopRepository) FindRule(_ heimdall.Context) (rule.Rule, error) { + return nil, errFunctionNotSupported +} +func (*noopRepository) AddRuleSet(_ string, _ []rule.Rule) error { return nil } +func (*noopRepository) UpdateRuleSet(_ string, _ []rule.Rule) error { return errFunctionNotSupported } +func (*noopRepository) DeleteRuleSet(_ string) error { return errFunctionNotSupported } diff --git a/internal/cache/redis/cluster.go b/internal/cache/redis/cluster.go index a1df78315..f99b3c0d9 100644 --- a/internal/cache/redis/cluster.go +++ b/internal/cache/redis/cluster.go @@ -36,7 +36,7 @@ func NewClusterCache(conf map[string]any, cw watcher.Watcher) (cache.Cache, erro } cfg := Config{ - baseConfig: baseConfig{ClientCache: clientCache{TTL: 5 * time.Minute}}, //nolint:gomnd + baseConfig: baseConfig{ClientCache: clientCache{TTL: 5 * time.Minute}}, //nolint:mnd } err := decodeConfig(conf, &cfg) diff --git a/internal/cache/redis/sentinel.go b/internal/cache/redis/sentinel.go index 2a8b2206f..0548b9480 100644 --- a/internal/cache/redis/sentinel.go +++ b/internal/cache/redis/sentinel.go @@ -40,7 +40,7 @@ func NewSentinelCache(conf map[string]any, cw watcher.Watcher) (cache.Cache, err } cfg := Config{ - baseConfig: baseConfig{ClientCache: clientCache{TTL: 5 * time.Minute}}, //nolint:gomnd + baseConfig: baseConfig{ClientCache: clientCache{TTL: 5 * time.Minute}}, //nolint:mnd } err := decodeConfig(conf, &cfg) diff --git a/internal/cache/redis/standalone.go b/internal/cache/redis/standalone.go index 33a97202d..ddc61e512 100644 --- a/internal/cache/redis/standalone.go +++ b/internal/cache/redis/standalone.go @@ -37,7 +37,7 @@ func NewStandaloneCache(conf map[string]any, cw watcher.Watcher) (cache.Cache, e } cfg := Config{ - baseConfig: baseConfig{ClientCache: clientCache{TTL: 5 * time.Minute}}, //nolint:gomnd + baseConfig: baseConfig{ClientCache: clientCache{TTL: 5 * time.Minute}}, //nolint:mnd } err := decodeConfig(conf, &cfg) diff --git a/internal/handler/metrics/module.go b/internal/handler/metrics/module.go index bcf12f408..f70ffd208 100644 --- a/internal/handler/metrics/module.go +++ b/internal/handler/metrics/module.go @@ -90,10 +90,10 @@ func newLifecycleManager(conf *config.Configuration, logger zerolog.Logger) life ServiceAddress: cfg.Address(), Server: &http.Server{ Handler: mux, - ReadTimeout: 5 * time.Second, // nolint: gomnd - WriteTimeout: 10 * time.Second, // nolint: gomnd - IdleTimeout: 90 * time.Second, // nolint: gomnd - MaxHeaderBytes: 4096, // nolint: gomnd + ReadTimeout: 5 * time.Second, // nolint: mnd + WriteTimeout: 10 * time.Second, // nolint: mnd + IdleTimeout: 90 * time.Second, // nolint: mnd + MaxHeaderBytes: 4096, // nolint: mnd ErrorLog: loggeradapter.NewStdLogger(logger), }, Logger: logger, diff --git a/internal/handler/middleware/http/dump/handler.go b/internal/handler/middleware/http/dump/handler.go index 82dbd1df7..2b9663ef2 100644 --- a/internal/handler/middleware/http/dump/handler.go +++ b/internal/handler/middleware/http/dump/handler.go @@ -163,7 +163,7 @@ func writeStatusLine(bw *bytes.Buffer, proto string, code int, scratch []byte) { bw.WriteString(proto + " ") if text := http.StatusText(code); text != "" { - bw.Write(strconv.AppendInt(scratch[:0], int64(code), 10)) //nolint:gomnd + bw.Write(strconv.AppendInt(scratch[:0], int64(code), 10)) //nolint:mnd bw.WriteByte(' ') bw.WriteString(text) bw.WriteString("\r\n") diff --git a/internal/handler/profiling/module.go b/internal/handler/profiling/module.go index cb2064129..2fe8b92e1 100644 --- a/internal/handler/profiling/module.go +++ b/internal/handler/profiling/module.go @@ -61,8 +61,8 @@ func newLifecycleManager(conf *config.Configuration, logger zerolog.Logger) life ServiceAddress: cfg.Address(), Logger: logger, Server: &http.Server{ - ReadHeaderTimeout: 5 * time.Second, // nolint: gomnd - IdleTimeout: 90 * time.Second, // nolint: gomnd + ReadHeaderTimeout: 5 * time.Second, // nolint: mnd + IdleTimeout: 90 * time.Second, // nolint: mnd ErrorLog: loggeradapter.NewStdLogger(logger), }, } diff --git a/internal/handler/proxy/request_context.go b/internal/handler/proxy/request_context.go index ffcf61d0e..75a69bf8f 100644 --- a/internal/handler/proxy/request_context.go +++ b/internal/handler/proxy/request_context.go @@ -56,15 +56,15 @@ func newContextFactory( // is possible per upstream Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ - Timeout: 30 * time.Second, //nolint:gomnd - KeepAlive: 30 * time.Second, //nolint:gomnd + Timeout: 30 * time.Second, //nolint:mnd + KeepAlive: 30 * time.Second, //nolint:mnd }).DialContext, ResponseHeaderTimeout: cfg.Timeout.Read, MaxIdleConns: cfg.ConnectionsLimit.MaxIdle, MaxIdleConnsPerHost: cfg.ConnectionsLimit.MaxIdlePerHost, MaxConnsPerHost: cfg.ConnectionsLimit.MaxPerHost, IdleConnTimeout: cfg.Timeout.Idle, - TLSHandshakeTimeout: 10 * time.Second, //nolint:gomnd + TLSHandshakeTimeout: 10 * time.Second, //nolint:mnd ExpectContinueTimeout: 1 * time.Second, ForceAttemptHTTP2: true, TLSClientConfig: tlsCfg, diff --git a/internal/handler/proxy/service_test.go b/internal/handler/proxy/service_test.go index c51d8027d..447aac188 100644 --- a/internal/handler/proxy/service_test.go +++ b/internal/handler/proxy/service_test.go @@ -983,7 +983,7 @@ func TestWebSocketSupport(t *testing.T) { require.NoError(t, err) upstreamSrv := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { - require.Equal(t, "/bar", req.URL.Path) + assert.Equal(t, "/bar", req.URL.Path) upgrader := websocket.Upgrader{ CheckOrigin: func(_ *http.Request) bool { @@ -992,22 +992,22 @@ func TestWebSocketSupport(t *testing.T) { } con, err := upgrader.Upgrade(rw, req, nil) - require.NoError(t, err) + assert.NoError(t, err) defer con.Close() err = con.WriteMessage(websocket.TextMessage, []byte("ping 1")) - require.NoError(t, err) + assert.NoError(t, err) _, message, err := con.ReadMessage() - require.NoError(t, err) + assert.NoError(t, err) assert.Equal(t, []byte("ping 1"), message) err = con.WriteMessage(websocket.TextMessage, []byte("ping 2")) - require.NoError(t, err) + assert.NoError(t, err) _, message, err = con.ReadMessage() - require.NoError(t, err) + assert.NoError(t, err) assert.Equal(t, []byte("ping 2"), message) })) defer upstreamSrv.Close() @@ -1092,7 +1092,7 @@ func TestServerSentEventsSupport(t *testing.T) { require.NoError(t, err) upstreamSrv := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { - require.Equal(t, "/bar", req.URL.Path) + assert.Equal(t, "/bar", req.URL.Path) rw.Header().Set("Content-Type", "text/event-stream") rw.Header().Set("Cache-Control", "no-cache") @@ -1102,9 +1102,9 @@ func TestServerSentEventsSupport(t *testing.T) { for i := range 5 { _, err := rw.Write(stringx.ToBytes(strconv.Itoa(i))) - require.NoError(t, err) + assert.NoError(t, err) - require.NoError(t, rc.Flush()) + assert.NoError(t, rc.Flush()) time.Sleep(50 * time.Millisecond) } diff --git a/internal/httpcache/round_tripper_test.go b/internal/httpcache/round_tripper_test.go index 5709a292d..d16680327 100644 --- a/internal/httpcache/round_tripper_test.go +++ b/internal/httpcache/round_tripper_test.go @@ -46,7 +46,7 @@ func TestRoundTripperRoundTrip(t *testing.T) { } _, err := w.Write([]byte("foobar")) - require.NoError(t, err) + assert.NoError(t, err) })) defer srv.Close() diff --git a/internal/rules/endpoint/authstrategy/client_credentials_test.go b/internal/rules/endpoint/authstrategy/client_credentials_test.go index 1b09f4029..ee3a829b6 100644 --- a/internal/rules/endpoint/authstrategy/client_credentials_test.go +++ b/internal/rules/endpoint/authstrategy/client_credentials_test.go @@ -90,7 +90,7 @@ func TestApplyClientCredentialsStrategy(t *testing.T) { w.WriteHeader(code) _, err = w.Write(rawResp) - require.NoError(t, err) + assert.NoError(t, err) })) defer srv.Close() diff --git a/internal/rules/endpoint/endpoint_test.go b/internal/rules/endpoint/endpoint_test.go index f805bc6f6..b2bad02c8 100644 --- a/internal/rules/endpoint/endpoint_test.go +++ b/internal/rules/endpoint/endpoint_test.go @@ -376,7 +376,7 @@ func TestEndpointSendRequest(t *testing.T) { if serverResponse != nil { _, err := w.Write(serverResponse) - require.NoError(t, err) + assert.NoError(t, err) } w.WriteHeader(statusCode) diff --git a/internal/rules/mechanisms/authenticators/generic_authenticator_test.go b/internal/rules/mechanisms/authenticators/generic_authenticator_test.go index e72870332..c8d485170 100644 --- a/internal/rules/mechanisms/authenticators/generic_authenticator_test.go +++ b/internal/rules/mechanisms/authenticators/generic_authenticator_test.go @@ -764,7 +764,7 @@ func TestGenericAuthenticatorExecute(t *testing.T) { w.Header().Set("Content-Type", responseContentType) w.Header().Set("Content-Length", strconv.Itoa(len(responseContent))) _, err := w.Write(responseContent) - require.NoError(t, err) + assert.NoError(t, err) } w.WriteHeader(responseCode) diff --git a/internal/rules/mechanisms/authenticators/jwt_authenticator_test.go b/internal/rules/mechanisms/authenticators/jwt_authenticator_test.go index bffad8452..babfa0052 100644 --- a/internal/rules/mechanisms/authenticators/jwt_authenticator_test.go +++ b/internal/rules/mechanisms/authenticators/jwt_authenticator_test.go @@ -881,7 +881,7 @@ func TestJwtAuthenticatorExecute(t *testing.T) { if jwksResponseContent != nil { w.Header().Set("Content-Type", jwksResponseContentType) _, err := w.Write(jwksResponseContent) - require.NoError(t, err) + assert.NoError(t, err) } else { w.WriteHeader(jwksResponseCode) } @@ -895,7 +895,7 @@ func TestJwtAuthenticatorExecute(t *testing.T) { if metadataResponseContent != nil { w.Header().Set("Content-Type", metadataResponseContentType) _, err = w.Write(metadataResponseContent) - require.NoError(t, err) + assert.NoError(t, err) } else { w.WriteHeader(metadataResponseCode) } diff --git a/internal/rules/mechanisms/authenticators/oauth2_introspection_authenticator_test.go b/internal/rules/mechanisms/authenticators/oauth2_introspection_authenticator_test.go index 82fb645c9..eb24652ad 100644 --- a/internal/rules/mechanisms/authenticators/oauth2_introspection_authenticator_test.go +++ b/internal/rules/mechanisms/authenticators/oauth2_introspection_authenticator_test.go @@ -642,7 +642,7 @@ func TestOauth2IntrospectionAuthenticatorExecute(t *testing.T) { if introspectionResponseContent != nil { w.Header().Set("Content-Type", introspectionResponseContentType) _, err := w.Write(introspectionResponseContent) - require.NoError(t, err) + assert.NoError(t, err) } w.WriteHeader(introspectionResponseCode) @@ -656,7 +656,7 @@ func TestOauth2IntrospectionAuthenticatorExecute(t *testing.T) { if metadataResponseContent != nil { w.Header().Set("Content-Type", metadataResponseContentType) _, err := w.Write(metadataResponseContent) - require.NoError(t, err) + assert.NoError(t, err) } w.WriteHeader(metadataResponseCode) diff --git a/internal/rules/mechanisms/authorizers/remote_authorizer_test.go b/internal/rules/mechanisms/authorizers/remote_authorizer_test.go index e5e10e117..f8b0008c0 100644 --- a/internal/rules/mechanisms/authorizers/remote_authorizer_test.go +++ b/internal/rules/mechanisms/authorizers/remote_authorizer_test.go @@ -526,7 +526,7 @@ func TestRemoteAuthorizerExecute(t *testing.T) { w.Header().Set("Content-Type", responseContentType) w.Header().Set("Content-Length", strconv.Itoa(len(responseContent))) _, err := w.Write(responseContent) - require.NoError(t, err) + assert.NoError(t, err) } w.WriteHeader(responseCode) diff --git a/internal/rules/mechanisms/contextualizers/generic_contextualizer_test.go b/internal/rules/mechanisms/contextualizers/generic_contextualizer_test.go index eb7b50b0b..38c79119f 100644 --- a/internal/rules/mechanisms/contextualizers/generic_contextualizer_test.go +++ b/internal/rules/mechanisms/contextualizers/generic_contextualizer_test.go @@ -516,7 +516,7 @@ func TestGenericContextualizerExecute(t *testing.T) { w.Header().Set("Content-Type", responseContentType) w.Header().Set("Content-Length", strconv.Itoa(len(responseContent))) _, err := w.Write(responseContent) - require.NoError(t, err) + assert.NoError(t, err) } w.WriteHeader(responseCode) diff --git a/internal/rules/mechanisms/finalizers/oauth2_client_credentials_finalizer_test.go b/internal/rules/mechanisms/finalizers/oauth2_client_credentials_finalizer_test.go index 03ae3c91e..d598b0fe3 100644 --- a/internal/rules/mechanisms/finalizers/oauth2_client_credentials_finalizer_test.go +++ b/internal/rules/mechanisms/finalizers/oauth2_client_credentials_finalizer_test.go @@ -447,7 +447,7 @@ func TestClientCredentialsFinalizerExecute(t *testing.T) { w.WriteHeader(code) _, err = w.Write(rawResp) - require.NoError(t, err) + assert.NoError(t, err) })) defer srv.Close() diff --git a/internal/rules/mechanisms/oauth2/metadata_endpoint.go b/internal/rules/mechanisms/oauth2/metadata_endpoint.go index 558f269be..a2f811c18 100644 --- a/internal/rules/mechanisms/oauth2/metadata_endpoint.go +++ b/internal/rules/mechanisms/oauth2/metadata_endpoint.go @@ -36,7 +36,7 @@ func (e *MetadataEndpoint) init() { } if e.HTTPCache == nil { - e.HTTPCache = &endpoint.HTTPCache{Enabled: true, DefaultTTL: 30 * time.Minute} //nolint:gomnd + e.HTTPCache = &endpoint.HTTPCache{Enabled: true, DefaultTTL: 30 * time.Minute} //nolint:mnd } } diff --git a/internal/rules/oauth2/clientcredentials/clientcredentials_test.go b/internal/rules/oauth2/clientcredentials/clientcredentials_test.go index dc70298ce..b56e7824f 100644 --- a/internal/rules/oauth2/clientcredentials/clientcredentials_test.go +++ b/internal/rules/oauth2/clientcredentials/clientcredentials_test.go @@ -83,7 +83,7 @@ func TestClientCredentialsToken(t *testing.T) { w.WriteHeader(code) _, err = w.Write(rawResp) - require.NoError(t, err) + assert.NoError(t, err) })) defer srv.Close() diff --git a/internal/rules/provider/kubernetes/admissioncontroller/service.go b/internal/rules/provider/kubernetes/admissioncontroller/service.go index 9db005289..4b8182e1f 100644 --- a/internal/rules/provider/kubernetes/admissioncontroller/service.go +++ b/internal/rules/provider/kubernetes/admissioncontroller/service.go @@ -72,10 +72,10 @@ func newService( return &http.Server{ Handler: hc, - ReadTimeout: 5 * time.Second, //nolint:gomnd - WriteTimeout: 10 * time.Second, //nolint:gomnd - IdleTimeout: 90 * time.Second, //nolint:gomnd - MaxHeaderBytes: int(4 * bytesize.KB), //nolint:gomnd + ReadTimeout: 5 * time.Second, //nolint:mnd + WriteTimeout: 10 * time.Second, //nolint:mnd + IdleTimeout: 90 * time.Second, //nolint:mnd + MaxHeaderBytes: int(4 * bytesize.KB), //nolint:mnd ErrorLog: loggeradapter.NewStdLogger(log), } } diff --git a/internal/rules/provider/kubernetes/api/v1alpha4/client_test.go b/internal/rules/provider/kubernetes/api/v1alpha4/client_test.go index cd39dface..948b8ab6b 100644 --- a/internal/rules/provider/kubernetes/api/v1alpha4/client_test.go +++ b/internal/rules/provider/kubernetes/api/v1alpha4/client_test.go @@ -106,7 +106,7 @@ func (s *ClientTestSuite) SetupSuite() { _, err = w.Write([]byte(response)) } - s.Require().NoError(err) + s.NoError(err) w.WriteHeader(http.StatusOK) })) diff --git a/internal/rules/provider/kubernetes/provider.go b/internal/rules/provider/kubernetes/provider.go index 6a9b61d1b..cc9c81d73 100644 --- a/internal/rules/provider/kubernetes/provider.go +++ b/internal/rules/provider/kubernetes/provider.go @@ -406,7 +406,7 @@ func (p *provider) updateStatus( p.l.Debug().Err(err).Msgf("New resource version available. Retrieving it.") // to avoid cascading reads and writes - time.Sleep(time.Duration(2*rand.Intn(50)) * time.Millisecond) //nolint:gomnd,gosec + time.Sleep(time.Duration(2*rand.Intn(50)) * time.Millisecond) //nolint:mnd,gosec rsKey := types.NamespacedName{Namespace: rs.Namespace, Name: rs.Name} if rs, err = repository.Get(ctx, rsKey, metav1.GetOptions{}); err != nil { diff --git a/internal/validation/validation.go b/internal/validation/validation.go index e8195f491..ed56c4db8 100644 --- a/internal/validation/validation.go +++ b/internal/validation/validation.go @@ -58,7 +58,7 @@ func init() { } validate.RegisterTagNameFunc(func(fld reflect.StructField) string { - return "'" + strings.SplitN(getTagValue(fld.Tag), ",", 2)[0] + "'" // nolint: gomnd + return "'" + strings.SplitN(getTagValue(fld.Tag), ",", 2)[0] + "'" // nolint: mnd }) } diff --git a/internal/x/opentelemetry/exporters/registry_test.go b/internal/x/opentelemetry/exporters/registry_test.go index 64ab1df54..3399da711 100644 --- a/internal/x/opentelemetry/exporters/registry_test.go +++ b/internal/x/opentelemetry/exporters/registry_test.go @@ -33,7 +33,7 @@ func TestRegistryEmptyStore(t *testing.T) { r := registry[trace.SpanExporter]{} // WHEN - err := r.store("first", func(_ context.Context) (trace.SpanExporter, error) { return nil, nil }) + err := r.store("first", func(_ context.Context) (trace.SpanExporter, error) { return nil, errors.New("test error") }) // THEN require.NoError(t, err) @@ -44,10 +44,10 @@ func TestRegistryNonEmptyStore(t *testing.T) { // GIVEN r := registry[trace.SpanExporter]{} - require.NoError(t, r.store("first", func(_ context.Context) (trace.SpanExporter, error) { return nil, nil })) + require.NoError(t, r.store("first", func(_ context.Context) (trace.SpanExporter, error) { return nil, errors.New("test error") })) // WHEN - err := r.store("second", func(_ context.Context) (trace.SpanExporter, error) { return nil, nil }) + err := r.store("second", func(_ context.Context) (trace.SpanExporter, error) { return nil, errors.New("test error") }) // THEN require.NoError(t, err) @@ -58,10 +58,10 @@ func TestRegistryDuplicateStore(t *testing.T) { // GIVEN r := registry[trace.SpanExporter]{} - require.NoError(t, r.store("first", func(_ context.Context) (trace.SpanExporter, error) { return nil, nil })) + require.NoError(t, r.store("first", func(_ context.Context) (trace.SpanExporter, error) { return nil, errors.New("test error") })) // WHEN - err := r.store("first", func(_ context.Context) (trace.SpanExporter, error) { return nil, nil }) + err := r.store("first", func(_ context.Context) (trace.SpanExporter, error) { return nil, errors.New("test error") }) // THEN require.Error(t, err) diff --git a/internal/x/radixtree/tree.go b/internal/x/radixtree/tree.go index a3355b0ba..bbb07087e 100644 --- a/internal/x/radixtree/tree.go +++ b/internal/x/radixtree/tree.go @@ -387,7 +387,7 @@ func (n *Tree[V]) findNode(path string, matcher Matcher[V]) (*Tree[V], int, []st if params == nil { // we don't expect more than 3 parameters to be defined for a path // even 3 is already too much - params = make([]string, 0, 3) //nolint:gomnd + params = make([]string, 0, 3) //nolint:mnd } return found, idx, append(params, thisToken), backtrack @@ -403,7 +403,7 @@ func (n *Tree[V]) findNode(path string, matcher Matcher[V]) (*Tree[V], int, []st if match := matcher.Match(value); match { // we don't expect more than 3 parameters to be defined for a path // even 3 is already too much - params = make([]string, 1, 3) //nolint:gomnd + params = make([]string, 1, 3) //nolint:mnd params[0] = path return n.catchAllChild, idx, params, false