From 4dab457634467b92cdadeacfc21988ff601ad52f Mon Sep 17 00:00:00 2001 From: kpacha Date: Tue, 10 Sep 2024 21:50:52 +0200 Subject: [PATCH] ignore unused params in functions --- proxy/proxy_test.go | 10 +++++----- router/gin/lua_test.go | 6 +++--- router/mux/lua_test.go | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/proxy/proxy_test.go b/proxy/proxy_test.go index ae5ad25..11fd21a 100644 --- a/proxy/proxy_test.go +++ b/proxy/proxy_test.go @@ -250,7 +250,7 @@ func TestProxyFactory(t *testing.T) { } dummyProxyFactory := proxy.FactoryFunc(func(_ *config.EndpointConfig) (proxy.Proxy, error) { - return func(ctx context.Context, req *proxy.Request) (*proxy.Response, error) { + return func(_ context.Context, req *proxy.Request) (*proxy.Response, error) { if req.Method != "POST" { t.Errorf("unexpected method %s", req.Method) } @@ -446,7 +446,7 @@ func Test_Issue7(t *testing.T) { json.Unmarshal([]byte(response), &r) dummyProxyFactory := proxy.FactoryFunc(func(_ *config.EndpointConfig) (proxy.Proxy, error) { - return func(ctx context.Context, req *proxy.Request) (*proxy.Response, error) { + return func(_ context.Context, _ *proxy.Request) (*proxy.Response, error) { return &proxy.Response{ Data: r, Metadata: proxy.Metadata{ @@ -518,7 +518,7 @@ func Test_jsonNumber(t *testing.T) { encoding.JSONDecoder(strings.NewReader(response), &r) dummyProxyFactory := proxy.FactoryFunc(func(_ *config.EndpointConfig) (proxy.Proxy, error) { - return func(ctx context.Context, req *proxy.Request) (*proxy.Response, error) { + return func(_ context.Context, _ *proxy.Request) (*proxy.Response, error) { return &proxy.Response{ Data: r, Metadata: proxy.Metadata{ @@ -594,7 +594,7 @@ func Test_keyValConverter(t *testing.T) { } dummyProxyFactory := proxy.FactoryFunc(func(_ *config.EndpointConfig) (proxy.Proxy, error) { - return func(ctx context.Context, req *proxy.Request) (*proxy.Response, error) { + return func(_ context.Context, _ *proxy.Request) (*proxy.Response, error) { return &proxy.Response{ Data: r, Metadata: proxy.Metadata{ @@ -674,7 +674,7 @@ func Test_listGrowsWhenUpperIndexOutOfBound(t *testing.T) { r := map[string]interface{}{} dummyProxyFactory := proxy.FactoryFunc(func(_ *config.EndpointConfig) (proxy.Proxy, error) { - return func(ctx context.Context, req *proxy.Request) (*proxy.Response, error) { + return func(_ context.Context, _ *proxy.Request) (*proxy.Response, error) { return &proxy.Response{ Data: r, Metadata: proxy.Metadata{ diff --git a/router/gin/lua_test.go b/router/gin/lua_test.go index 5c7d465..0be603d 100644 --- a/router/gin/lua_test.go +++ b/router/gin/lua_test.go @@ -98,7 +98,7 @@ func TestHandlerFactory_error(t *testing.T) { } hf := func(_ *config.EndpointConfig, _ proxy.Proxy) gin.HandlerFunc { - return func(c *gin.Context) { + return func(_ *gin.Context) { t.Error("the handler shouldn't be executed") } } @@ -131,7 +131,7 @@ func TestHandlerFactory_errorHTTP(t *testing.T) { } hf := func(_ *config.EndpointConfig, _ proxy.Proxy) gin.HandlerFunc { - return func(c *gin.Context) { + return func(_ *gin.Context) { t.Error("the handler shouldn't be executed") } } @@ -164,7 +164,7 @@ func TestHandlerFactory_errorHTTPWithContentType(t *testing.T) { } hf := func(_ *config.EndpointConfig, _ proxy.Proxy) gin.HandlerFunc { - return func(c *gin.Context) { + return func(_ *gin.Context) { t.Error("the handler shouldn't be executed") } } diff --git a/router/mux/lua_test.go b/router/mux/lua_test.go index 6fbb0df..d0fefa8 100644 --- a/router/mux/lua_test.go +++ b/router/mux/lua_test.go @@ -33,7 +33,7 @@ func TestHandlerFactory(t *testing.T) { } hf := func(_ *config.EndpointConfig, _ proxy.Proxy) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { + return func(_ http.ResponseWriter, r *http.Request) { if URL := r.URL.String(); URL != "/some-path/42?extra=foo&id=1&more=true" { t.Errorf("unexpected URL: %s", URL) } @@ -89,7 +89,7 @@ func TestHandlerFactory_error(t *testing.T) { } hf := func(_ *config.EndpointConfig, _ proxy.Proxy) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { + return func(_ http.ResponseWriter, _ *http.Request) { t.Error("the handler shouldn't be executed") } } @@ -120,7 +120,7 @@ func TestHandlerFactory_errorHTTP(t *testing.T) { } hf := func(_ *config.EndpointConfig, _ proxy.Proxy) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { + return func(_ http.ResponseWriter, _ *http.Request) { t.Error("the handler shouldn't be executed") } } @@ -151,7 +151,7 @@ func TestHandlerFactory_errorHTTPWithContentType(t *testing.T) { } hf := func(_ *config.EndpointConfig, _ proxy.Proxy) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { + return func(_ http.ResponseWriter, _ *http.Request) { t.Error("the handler shouldn't be executed") } }