mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 09:38:39 +08:00
Upgrade golangci-lint (#24707)
Signed-off-by: Enwei Jiao <enwei.jiao@zilliz.com>
This commit is contained in:
parent
89db828f71
commit
d3af451d92
@ -26,6 +26,10 @@ linters:
|
|||||||
# - gocritic
|
# - gocritic
|
||||||
|
|
||||||
linters-settings:
|
linters-settings:
|
||||||
|
revive:
|
||||||
|
rules:
|
||||||
|
- name: unused-parameter
|
||||||
|
disabled: true
|
||||||
misspell:
|
misspell:
|
||||||
locale: US
|
locale: US
|
||||||
gocritic:
|
gocritic:
|
||||||
@ -36,14 +40,19 @@ linters-settings:
|
|||||||
failOnError: true
|
failOnError: true
|
||||||
rules: 'rules.go'
|
rules: 'rules.go'
|
||||||
depguard:
|
depguard:
|
||||||
list-type: denylist
|
rules:
|
||||||
include-go-root: true
|
main:
|
||||||
packages:
|
deny:
|
||||||
- errors
|
- pkg: 'errors'
|
||||||
- github.com/pkg/errors
|
desc: not allowd, use github.com/cockroachdb/errors
|
||||||
- github.com/pingcap/errors
|
- pkg: 'github.com/pkg/errors'
|
||||||
- golang.org/x/xerrors
|
desc: not allowd, use github.com/cockroachdb/errors
|
||||||
- github.com/go-errors/errors
|
- pkg: 'github.com/pingcap/errors'
|
||||||
|
desc: not allowd, use github.com/cockroachdb/errors
|
||||||
|
- pkg: 'golang.org/x/xerrors'
|
||||||
|
desc: not allowd, use github.com/cockroachdb/errors
|
||||||
|
- pkg: 'github.com/go-errors/errors'
|
||||||
|
desc: not allowd, use github.com/cockroachdb/errors
|
||||||
forbidigo:
|
forbidigo:
|
||||||
forbid:
|
forbid:
|
||||||
- '^time\.Tick$'
|
- '^time\.Tick$'
|
||||||
|
|||||||
2
Makefile
2
Makefile
@ -49,7 +49,7 @@ get-build-deps:
|
|||||||
# attention: upgrade golangci-lint should also change Dockerfiles in build/docker/builder/cpu/<os>
|
# attention: upgrade golangci-lint should also change Dockerfiles in build/docker/builder/cpu/<os>
|
||||||
getdeps:
|
getdeps:
|
||||||
@mkdir -p $(INSTALL_PATH)
|
@mkdir -p $(INSTALL_PATH)
|
||||||
@$(INSTALL_PATH)/golangci-lint --version 2>&1 1>/dev/null || (echo "Installing golangci-lint into ./bin/" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(INSTALL_PATH) v1.46.2)
|
@$(INSTALL_PATH)/golangci-lint --version 2>&1 1>/dev/null || (echo "Installing golangci-lint into ./bin/" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(INSTALL_PATH) v1.53.1)
|
||||||
@$(INSTALL_PATH)/mockery --version 2>&1 1>/dev/null || (echo "Installing mockery v2.16.0 to ./bin/" && GOBIN=$(INSTALL_PATH)/ go install github.com/vektra/mockery/v2@v2.16.0)
|
@$(INSTALL_PATH)/mockery --version 2>&1 1>/dev/null || (echo "Installing mockery v2.16.0 to ./bin/" && GOBIN=$(INSTALL_PATH)/ go install github.com/vektra/mockery/v2@v2.16.0)
|
||||||
|
|
||||||
tools/bin/revive: tools/check/go.mod
|
tools/bin/revive: tools/check/go.mod
|
||||||
|
|||||||
2
go.mod
2
go.mod
@ -29,7 +29,7 @@ require (
|
|||||||
github.com/nats-io/nats.go v1.24.0
|
github.com/nats-io/nats.go v1.24.0
|
||||||
github.com/panjf2000/ants/v2 v2.7.2
|
github.com/panjf2000/ants/v2 v2.7.2
|
||||||
github.com/prometheus/client_golang v1.14.0
|
github.com/prometheus/client_golang v1.14.0
|
||||||
github.com/quasilyte/go-ruleguard/dsl v0.3.21
|
github.com/quasilyte/go-ruleguard/dsl v0.3.22
|
||||||
github.com/samber/lo v1.27.0
|
github.com/samber/lo v1.27.0
|
||||||
github.com/sbinet/npyio v0.6.0
|
github.com/sbinet/npyio v0.6.0
|
||||||
github.com/spf13/viper v1.8.1
|
github.com/spf13/viper v1.8.1
|
||||||
|
|||||||
4
go.sum
4
go.sum
@ -714,8 +714,8 @@ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1
|
|||||||
github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI=
|
github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI=
|
||||||
github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY=
|
github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY=
|
||||||
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
||||||
github.com/quasilyte/go-ruleguard/dsl v0.3.21 h1:vNkC6fC6qMLzCOGbnIHOd5ixUGgTbp3Z4fGnUgULlDA=
|
github.com/quasilyte/go-ruleguard/dsl v0.3.22 h1:wd8zkOhSNr+I+8Qeciml08ivDt1pSXe60+5DqOpCjPE=
|
||||||
github.com/quasilyte/go-ruleguard/dsl v0.3.21/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU=
|
github.com/quasilyte/go-ruleguard/dsl v0.3.22/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU=
|
||||||
github.com/rivo/tview v0.0.0-20200219210816-cd38d7432498/go.mod h1:6lkG1x+13OShEf0EaOCaTQYyB7d5nSbb181KtjlS+84=
|
github.com/rivo/tview v0.0.0-20200219210816-cd38d7432498/go.mod h1:6lkG1x+13OShEf0EaOCaTQYyB7d5nSbb181KtjlS+84=
|
||||||
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
github.com/rogpeppe/clock v0.0.0-20190514195947-2896927a307a/go.mod h1:4r5QyqhjIWCcK8DO4KMclc5Iknq5qVBAlbYYzAbUScQ=
|
github.com/rogpeppe/clock v0.0.0-20190514195947-2896927a307a/go.mod h1:4r5QyqhjIWCcK8DO4KMclc5Iknq5qVBAlbYYzAbUScQ=
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"time"
|
||||||
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
@ -67,7 +68,8 @@ func ServeHTTP() {
|
|||||||
go func() {
|
go func() {
|
||||||
bindAddr := getHTTPAddr()
|
bindAddr := getHTTPAddr()
|
||||||
log.Info("management listen", zap.String("addr", bindAddr))
|
log.Info("management listen", zap.String("addr", bindAddr))
|
||||||
if err := http.ListenAndServe(bindAddr, nil); err != nil {
|
server := &http.Server{Addr: bindAddr, ReadTimeout: 10 * time.Second}
|
||||||
|
if err := server.ListenAndServe(); err != nil {
|
||||||
log.Error("handle metrics failed", zap.Error(err))
|
log.Error("handle metrics failed", zap.Error(err))
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|||||||
@ -29,6 +29,7 @@ type tsoAllocator interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// use timestampAllocatorInterface to keep other components testable
|
// use timestampAllocatorInterface to keep other components testable
|
||||||
|
//
|
||||||
//go:generate mockery --name=timestampAllocatorInterface --filename=mock_tso_test.go --outpkg=proxy --output=. --inpackage --structname=mockTimestampAllocator --with-expecter
|
//go:generate mockery --name=timestampAllocatorInterface --filename=mock_tso_test.go --outpkg=proxy --output=. --inpackage --structname=mockTimestampAllocator --with-expecter
|
||||||
type timestampAllocatorInterface interface {
|
type timestampAllocatorInterface interface {
|
||||||
AllocTimestamp(ctx context.Context, req *rootcoordpb.AllocTimestampRequest) (*rootcoordpb.AllocTimestampResponse, error)
|
AllocTimestamp(ctx context.Context, req *rootcoordpb.AllocTimestampRequest) (*rootcoordpb.AllocTimestampResponse, error)
|
||||||
|
|||||||
@ -24,7 +24,6 @@ var (
|
|||||||
|
|
||||||
// RoundRobinPolicy do the query with multiple dml channels
|
// RoundRobinPolicy do the query with multiple dml channels
|
||||||
// if request failed, it finds shard leader for failed dml channels
|
// if request failed, it finds shard leader for failed dml channels
|
||||||
//
|
|
||||||
func RoundRobinPolicy(
|
func RoundRobinPolicy(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
mgr *shardClientMgr,
|
mgr *shardClientMgr,
|
||||||
|
|||||||
@ -28,12 +28,13 @@ import "C"
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/milvus-io/milvus/pkg/common"
|
|
||||||
"github.com/milvus-io/milvus/pkg/util/funcutil"
|
|
||||||
"sort"
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"github.com/milvus-io/milvus/pkg/common"
|
||||||
|
"github.com/milvus-io/milvus/pkg/util/funcutil"
|
||||||
|
|
||||||
"github.com/cockroachdb/errors"
|
"github.com/cockroachdb/errors"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"go.opentelemetry.io/otel/trace"
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
|||||||
@ -31,6 +31,7 @@ func NewMinioClient(address string, opts *minio.Options) (*minio.Client, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Credential is defined to mock aliyun credential.Credentials
|
// Credential is defined to mock aliyun credential.Credentials
|
||||||
|
//
|
||||||
//go:generate mockery --name=Credential --with-expecter
|
//go:generate mockery --name=Credential --with-expecter
|
||||||
type Credential interface {
|
type Credential interface {
|
||||||
credentials.Credential
|
credentials.Credential
|
||||||
|
|||||||
@ -1320,9 +1320,7 @@ func (dataDefinitionCodec *DataDefinitionCodec) Deserialize(blobs []*Blob) (ts [
|
|||||||
binlogReader.Close()
|
binlogReader.Close()
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
for idx := range stringPayload {
|
requestsStrings = append(requestsStrings, stringPayload...)
|
||||||
requestsStrings = append(requestsStrings, stringPayload[idx])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
eventReader.Close()
|
eventReader.Close()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user