From 6f87a7dec0479cece5a44b228933645cb3f16939 Mon Sep 17 00:00:00 2001 From: Xiaobo Liu Date: Thu, 29 May 2025 09:19:52 +0800 Subject: [PATCH] Interface{} can be replaced by any Signed-off-by: Xiaobo Liu --- client.go | 6 +++--- internal/hmac/pool.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client.go b/client.go index ebd8879..87d355f 100644 --- a/client.go +++ b/client.go @@ -319,7 +319,7 @@ func (t *clientTransaction) handle(e Event) { } var clientTransactionPool = &sync.Pool{ //nolint:gochecknoglobals - New: func() interface{} { + New: func() any { return &clientTransaction{ raw: make([]byte, 1500), } @@ -562,7 +562,7 @@ func (s *callbackWaitHandler) setCallback(f func(event Event)) { } var callbackWaitHandlerPool = sync.Pool{ //nolint:gochecknoglobals - New: func() interface{} { + New: func() any { return &callbackWaitHandler{ cond: sync.NewCond(new(sync.Mutex)), } @@ -618,7 +618,7 @@ type buffer struct { } var bufferPool = &sync.Pool{ //nolint:gochecknoglobals - New: func() interface{} { + New: func() any { return &buffer{buf: make([]byte, 2048)} }, } diff --git a/internal/hmac/pool.go b/internal/hmac/pool.go index 14aa9d8..2694d74 100644 --- a/internal/hmac/pool.go +++ b/internal/hmac/pool.go @@ -38,7 +38,7 @@ func (h *hmac) resetTo(key []byte) { } var hmacSHA1Pool = &sync.Pool{ //nolint:gochecknoglobals - New: func() interface{} { + New: func() any { h := New(sha1.New, make([]byte, sha1.BlockSize)) return h @@ -62,7 +62,7 @@ func PutSHA1(h hash.Hash) { } var hmacSHA256Pool = &sync.Pool{ //nolint:gochecknoglobals - New: func() interface{} { + New: func() any { h := New(sha256.New, make([]byte, sha256.BlockSize)) return h