mirror of https://github.com/go-redis/redis.git
Merge pull request #1562 from johejo/golangci-lint_v1.32
Update golangci-lint to v1.32
This commit is contained in:
commit
5aedb90a65
|
@ -45,6 +45,6 @@ jobs:
|
||||||
fi
|
fi
|
||||||
- name: Install golangci
|
- name: Install golangci
|
||||||
run: |
|
run: |
|
||||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.31.0
|
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.32.2
|
||||||
- name: Test
|
- name: Test
|
||||||
run: make
|
run: make
|
||||||
|
|
|
@ -19,3 +19,6 @@ linters:
|
||||||
- exhaustive
|
- exhaustive
|
||||||
- nestif
|
- nestif
|
||||||
- nlreturn
|
- nlreturn
|
||||||
|
- exhaustivestruct
|
||||||
|
- wrapcheck
|
||||||
|
- errorlint
|
||||||
|
|
|
@ -17,4 +17,4 @@ go_import_path: github.com/go-redis/redis
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s --
|
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s --
|
||||||
-b $(go env GOPATH)/bin v1.31.0
|
-b $(go env GOPATH)/bin v1.32.2
|
||||||
|
|
|
@ -131,7 +131,7 @@ func ScanSlice(data []string, slice interface{}) error {
|
||||||
for i, s := range data {
|
for i, s := range data {
|
||||||
elem := next()
|
elem := next()
|
||||||
if err := Scan([]byte(s), elem.Addr().Interface()); err != nil {
|
if err := Scan([]byte(s), elem.Addr().Interface()); err != nil {
|
||||||
err = fmt.Errorf("redis: ScanSlice index=%d value=%q failed: %s", i, s, err)
|
err = fmt.Errorf("redis: ScanSlice index=%d value=%q failed: %w", i, s, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,16 +50,6 @@ func isLower(s string) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func Unwrap(err error) error {
|
|
||||||
u, ok := err.(interface {
|
|
||||||
Unwrap() error
|
|
||||||
})
|
|
||||||
if !ok {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return u.Unwrap()
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
func WithSpan(ctx context.Context, name string, fn func(context.Context, trace.Span) error) error {
|
func WithSpan(ctx context.Context, name string, fn func(context.Context, trace.Span) error) error {
|
||||||
|
|
|
@ -271,7 +271,7 @@ func setupUnixConn(u *url.URL) (*Options, error) {
|
||||||
|
|
||||||
db, err := strconv.Atoi(dbStr)
|
db, err := strconv.Atoi(dbStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("redis: invalid database number: %s", err)
|
return nil, fmt.Errorf("redis: invalid database number: %w", err)
|
||||||
}
|
}
|
||||||
o.DB = db
|
o.DB = db
|
||||||
|
|
||||||
|
|
3
redis.go
3
redis.go
|
@ -2,6 +2,7 @@ package redis
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -230,7 +231,7 @@ func (c *baseClient) _getConn(ctx context.Context) (*pool.Conn, error) {
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.connPool.Remove(ctx, cn, err)
|
c.connPool.Remove(ctx, cn, err)
|
||||||
if err := internal.Unwrap(err); err != nil {
|
if err := errors.Unwrap(err); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in New Issue