From 26373ef2f13351d51b481e53069063aed8dc1318 Mon Sep 17 00:00:00 2001 From: monkey Date: Thu, 13 May 2021 10:33:38 +0800 Subject: [PATCH] follow to golang-lint 1.40 Signed-off-by: monkey --- error.go | 1 + internal/hashtag/hashtag.go | 2 +- internal/log.go | 2 ++ internal/pool/pool.go | 5 ++++- internal/proto/reader.go | 1 + 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/error.go b/error.go index 2ed5dc62..ad9e173e 100644 --- a/error.go +++ b/error.go @@ -10,6 +10,7 @@ import ( "github.com/go-redis/redis/v8/internal/proto" ) +// ErrClosed performs any operation on the closed client will return this error. var ErrClosed = pool.ErrClosed type Error interface { diff --git a/internal/hashtag/hashtag.go b/internal/hashtag/hashtag.go index 2fc74ad1..b3a4f211 100644 --- a/internal/hashtag/hashtag.go +++ b/internal/hashtag/hashtag.go @@ -60,7 +60,7 @@ func RandomSlot() int { return rand.Intn(slotNumber) } -// hashSlot returns a consistent slot number between 0 and 16383 +// Slot returns a consistent slot number between 0 and 16383 // for any given string key. func Slot(key string) int { if key == "" { diff --git a/internal/log.go b/internal/log.go index 3810f9e4..c8b9213d 100644 --- a/internal/log.go +++ b/internal/log.go @@ -19,6 +19,8 @@ func (l *logger) Printf(ctx context.Context, format string, v ...interface{}) { _ = l.log.Output(2, fmt.Sprintf(format, v...)) } +// Logger calls Output to print to the stderr. +// Arguments are handled in the manner of fmt.Print. var Logger Logging = &logger{ log: log.New(os.Stderr, "redis: ", log.LstdFlags|log.Lshortfile), } diff --git a/internal/pool/pool.go b/internal/pool/pool.go index 74fbb37a..4d247b30 100644 --- a/internal/pool/pool.go +++ b/internal/pool/pool.go @@ -12,7 +12,10 @@ import ( ) var ( - ErrClosed = errors.New("redis: client is closed") + // ErrClosed performs any operation on the closed client will return this error. + ErrClosed = errors.New("redis: client is closed") + + // ErrPoolTimeout timed out waiting to get a connection from the connection pool. ErrPoolTimeout = errors.New("redis: connection pool timeout") ) diff --git a/internal/proto/reader.go b/internal/proto/reader.go index 0ab8c9d2..10d1b423 100644 --- a/internal/proto/reader.go +++ b/internal/proto/reader.go @@ -8,6 +8,7 @@ import ( "github.com/go-redis/redis/v8/internal/util" ) +// redis resp protocol data type. const ( ErrorReply = '-' StatusReply = '+'