Skip to content

Commit

Permalink
all: set unused parameter to "_"
Browse files Browse the repository at this point in the history
  • Loading branch information
shuLhan committed Feb 15, 2024
1 parent 6ef5bdf commit c14c0aa
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion api/telegram/bot/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestCommand_validate(t *testing.T) {
cmd: Command{
Command: "help",
Description: "Bantuan",
Handler: func(up Update) {},
Handler: func(_ Update) {},
},
}}

Expand Down
4 changes: 2 additions & 2 deletions lib/http/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var (

client = &http.Client{}

cbNone = func(epr *EndpointRequest) ([]byte, error) {
cbNone = func(_ *EndpointRequest) ([]byte, error) {
return nil, nil
}

Expand Down Expand Up @@ -140,7 +140,7 @@ func registerEndpoints() {
err = testServer.RegisterEndpoint(&Endpoint{
Path: "/download",
ResponseType: ResponseTypePlain,
Call: func(epr *EndpointRequest) ([]byte, error) {
Call: func(_ *EndpointRequest) ([]byte, error) {
return testDownloadBody, nil
},
})
Expand Down
8 changes: 4 additions & 4 deletions lib/http/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func TestRegisterDelete(t *testing.T) {
}
}

var testEvaluator = func(req *http.Request, reqBody []byte) error {
var testEvaluator = func(req *http.Request, _ []byte) error {
k := req.Form.Get("k")

if len(k) == 0 {
Expand Down Expand Up @@ -662,16 +662,16 @@ func TestServeHTTPOptions(t *testing.T) {

func TestStatusError(t *testing.T) {
var (
cbError = func(epr *EndpointRequest) ([]byte, error) {
cbError = func(_ *EndpointRequest) ([]byte, error) {
return nil, &liberrors.E{
Code: http.StatusLengthRequired,
Message: `Length required`,
}
}
cbNoCode = func(epr *EndpointRequest) ([]byte, error) {
cbNoCode = func(_ *EndpointRequest) ([]byte, error) {
return nil, liberrors.Internal(nil)
}
cbCustomErr = func(epr *EndpointRequest) ([]byte, error) {
cbCustomErr = func(_ *EndpointRequest) ([]byte, error) {
return nil, fmt.Errorf("Custom error")
}

Expand Down
4 changes: 2 additions & 2 deletions lib/http/sse_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func testSSEEndpointEmptyCall(t *testing.T, httpd *Server) {
func testSSEEndpointDuplicatePath(t *testing.T, httpd *Server) {
var ep = &Endpoint{
Path: `/sse`,
Call: func(req *EndpointRequest) ([]byte, error) { return nil, nil },
Call: func(_ *EndpointRequest) ([]byte, error) { return nil, nil },
}

var err = httpd.RegisterEndpoint(ep)
Expand All @@ -56,7 +56,7 @@ func testSSEEndpointDuplicatePath(t *testing.T, httpd *Server) {

var sse = &SSEEndpoint{
Path: `/sse`,
Call: func(sseconn *SSEConn) {},
Call: func(_ *SSEConn) {},
}

err = httpd.RegisterSSE(sse)
Expand Down
16 changes: 8 additions & 8 deletions lib/websocket/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func TestClientPing(t *testing.T) {
gotFrame <- f
return nil
},
handlePong: func(cl *Client, f *Frame) (err error) {
handlePong: func(_ *Client, f *Frame) (err error) {
gotFrame <- f
return nil
},
Expand Down Expand Up @@ -306,13 +306,13 @@ func TestClient_send_FrameText(t *testing.T) {

cl = &Client{
Endpoint: _testEndpointAuth,
handleClose: func(cl *Client, f *Frame) error {
handleClose: func(_ *Client, f *Frame) error {
cl.sendClose(f.closeCode, nil)
cl.Quit()
gotFrame <- f
return nil
},
HandleText: func(cl *Client, f *Frame) error {
HandleText: func(_ *Client, f *Frame) error {
gotFrame <- f
return nil
},
Expand Down Expand Up @@ -442,7 +442,7 @@ func TestClientFragmentation(t *testing.T) {
gotFrame <- f
return nil
},
HandleText: func(cl *Client, f *Frame) error {
HandleText: func(_ *Client, f *Frame) error {
gotFrame <- f
return nil
},
Expand Down Expand Up @@ -489,11 +489,11 @@ func TestClientFragmentation2(t *testing.T) {
gotFrame = make(chan *Frame)
testClient = &Client{
Endpoint: _testEndpointAuth,
handlePong: func(cl *Client, f *Frame) error {
handlePong: func(_ *Client, f *Frame) error {
gotFrame <- f
return nil
},
HandleText: func(cl *Client, f *Frame) error {
HandleText: func(_ *Client, f *Frame) error {
gotFrame <- f
return nil
},
Expand Down Expand Up @@ -603,7 +603,7 @@ func TestClientSendBin(t *testing.T) {

cl = &Client{
Endpoint: _testEndpointAuth,
HandleBin: func(cl *Client, f *Frame) error {
HandleBin: func(_ *Client, f *Frame) error {
gotFrame <- f
return nil
},
Expand Down Expand Up @@ -661,7 +661,7 @@ func TestClientSendPing(t *testing.T) {
gotFrame = make(chan *Frame)
testClient = &Client{
Endpoint: _testEndpointAuth,
handlePong: func(cl *Client, f *Frame) error {
handlePong: func(_ *Client, f *Frame) error {
gotFrame <- f
return nil
},
Expand Down
2 changes: 1 addition & 1 deletion lib/websocket/rootroute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

func testRouteHandler(t *testing.T, target string) RouteHandler {
return func(ctx context.Context, req *Request) (res Response) {
return func(_ context.Context, req *Request) (res Response) {
test.Assert(t, "routeHandler", target, req.Target)
return
}
Expand Down
2 changes: 1 addition & 1 deletion lib/websocket/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func TestServer_upgrader_nonblocking(t *testing.T) {
qtext = make(chan []byte, 1)
cl = &Client{
Endpoint: _testEndpointAuth,
HandleText: func(cl *Client, frame *Frame) (err error) {
HandleText: func(_ *Client, frame *Frame) (err error) {
qtext <- frame.Payload()
return nil
},
Expand Down

0 comments on commit c14c0aa

Please sign in to comment.