Skip to content

Commit fa8846c

Browse files
Daniel AdamDaniel Adam
authored andcommitted
Fix issues reported by golangsci-lint
1 parent c5bc6c8 commit fa8846c

34 files changed

+73
-85
lines changed

dtls/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func Client(conn *dtls.Conn, opts ...udp.Option) *udpClient.Conn {
8080
errorsFunc(fmt.Errorf("dtls: %v: %w", conn.RemoteAddr(), err))
8181
}
8282

83-
createBlockWise := func(cc *udpClient.Conn) *blockwise.BlockWise[*udpClient.Conn] {
83+
createBlockWise := func(*udpClient.Conn) *blockwise.BlockWise[*udpClient.Conn] {
8484
return nil
8585
}
8686
if cfg.BlockwiseEnable {

dtls/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func TestConnGetSeparateMessage(t *testing.T) {
207207
require.NoError(t, errS)
208208
}()
209209

210-
cc, err := dtls.Dial(l.Addr().String(), dtlsCfg, options.WithHandlerFunc(func(w *responsewriter.ResponseWriter[*client.Conn], r *pool.Message) {
210+
cc, err := dtls.Dial(l.Addr().String(), dtlsCfg, options.WithHandlerFunc(func(_ *responsewriter.ResponseWriter[*client.Conn], r *pool.Message) {
211211
assert.NoError(t, fmt.Errorf("none msg expected comes: %+v", r))
212212
}))
213213
require.NoError(t, err)

dtls/server/config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type HandlerFunc = func(*responsewriter.ResponseWriter[*udpClient.Conn], *pool.M
2020
type ErrorFunc = func(error)
2121

2222
// OnNewConnFunc is the callback for new connections.
23-
type OnNewConnFunc = func(cc *udpClient.Conn)
23+
type OnNewConnFunc = func(*udpClient.Conn)
2424

2525
type GetMIDFunc = func() int32
2626

@@ -34,10 +34,10 @@ var DefaultConfig = func() Config {
3434
}
3535
return inactivity.New(timeout, onInactive)
3636
},
37-
RequestMonitor: func(cc *udpClient.Conn, req *pool.Message) (bool, error) {
37+
RequestMonitor: func(*udpClient.Conn, *pool.Message) (bool, error) {
3838
return false, nil
3939
},
40-
OnNewConn: func(cc *udpClient.Conn) {
40+
OnNewConn: func(*udpClient.Conn) {
4141
// do nothing by default
4242
},
4343
TransmissionNStart: 1,
@@ -46,7 +46,7 @@ var DefaultConfig = func() Config {
4646
GetMID: message.GetMID,
4747
MTU: udpClient.DefaultMTU,
4848
}
49-
opts.Handler = func(w *responsewriter.ResponseWriter[*udpClient.Conn], r *pool.Message) {
49+
opts.Handler = func(w *responsewriter.ResponseWriter[*udpClient.Conn], _ *pool.Message) {
5050
if err := w.SetResponse(codes.NotFound, message.TextPlain, nil); err != nil {
5151
opts.Errors(fmt.Errorf("dtls server: cannot set response: %w", err))
5252
}

dtls/server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ func (s *Server) Stop() {
188188
}
189189

190190
func (s *Server) createConn(connection *coapNet.Conn, inactivityMonitor udpClient.InactivityMonitor, requestMonitor udpClient.RequestMonitorFunc) *udpClient.Conn {
191-
createBlockWise := func(cc *udpClient.Conn) *blockwise.BlockWise[*udpClient.Conn] {
191+
createBlockWise := func(*udpClient.Conn) *blockwise.BlockWise[*udpClient.Conn] {
192192
return nil
193193
}
194194
if s.cfg.BlockwiseEnable {

message/codes/codes_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func FuzzUnmarshalJSON(f *testing.F) {
9393
f.Add([]byte("0x2a"))
9494
f.Add([]byte("42"))
9595

96-
f.Fuzz(func(t *testing.T, input_data []byte) {
96+
f.Fuzz(func(_ *testing.T, input_data []byte) {
9797
var got Code
9898
_ = got.UnmarshalJSON(input_data)
9999
})

message/options_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ func TestQueryOption(t *testing.T) {
352352
}
353353

354354
func FuzzUnmarshalData(f *testing.F) {
355-
f.Fuzz(func(t *testing.T, input_data []byte) {
355+
f.Fuzz(func(_ *testing.T, input_data []byte) {
356356
uoptions := make(Options, 0, 10)
357357
_, _ = uoptions.Unmarshal(input_data, CoapOptionDefs)
358358
})

mux/example_logging_middleware_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func loggingMiddleware(next mux.Handler) mux.Handler {
1616

1717
func Example_authenticationMiddleware() {
1818
r := mux.NewRouter()
19-
r.HandleFunc("/", func(w mux.ResponseWriter, r *mux.Message) {
19+
r.HandleFunc("/", func(mux.ResponseWriter, *mux.Message) {
2020
// Do something here
2121
})
2222
r.Use(loggingMiddleware)

mux/router.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func NewRouter() *Router {
7474
m: new(sync.RWMutex),
7575
z: make(map[string]Route),
7676
}
77-
router.defaultHandler = HandlerFunc(func(w ResponseWriter, m *Message) {
77+
router.defaultHandler = HandlerFunc(func(w ResponseWriter, _ *Message) {
7878
if err := w.SetResponse(codes.NotFound, message.TextPlain, nil); err != nil {
7979
router.errors(fmt.Errorf("router handler: cannot set response: %w", err))
8080
}

mux/router_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func TestMux(t *testing.T) {
111111

112112
for _, test := range tests {
113113
t.Run(test.title, func(t *testing.T) {
114-
r.HandleFunc(test.pathTemplate, func(w mux.ResponseWriter, r *mux.Message) {})
114+
r.HandleFunc(test.pathTemplate, func(mux.ResponseWriter, *mux.Message) {})
115115
testRegexp(t, r, test)
116116
testRoute(t, r, test)
117117
err := r.HandleRemove(test.pathTemplate)

net/blockwise/blockwise.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func New[C Client](
163163
getSentRequestFromOutside func(token message.Token) (*pool.Message, bool),
164164
) *BlockWise[C] {
165165
if getSentRequestFromOutside == nil {
166-
getSentRequestFromOutside = func(token message.Token) (*pool.Message, bool) { return nil, false }
166+
getSentRequestFromOutside = func(message.Token) (*pool.Message, bool) { return nil, false }
167167
}
168168
return &BlockWise[C]{
169169
cc: cc,

0 commit comments

Comments
 (0)