mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +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
|
||||
|
||||
linters-settings:
|
||||
revive:
|
||||
rules:
|
||||
- name: unused-parameter
|
||||
disabled: true
|
||||
misspell:
|
||||
locale: US
|
||||
gocritic:
|
||||
@ -36,14 +40,19 @@ linters-settings:
|
||||
failOnError: true
|
||||
rules: 'rules.go'
|
||||
depguard:
|
||||
list-type: denylist
|
||||
include-go-root: true
|
||||
packages:
|
||||
- errors
|
||||
- github.com/pkg/errors
|
||||
- github.com/pingcap/errors
|
||||
- golang.org/x/xerrors
|
||||
- github.com/go-errors/errors
|
||||
rules:
|
||||
main:
|
||||
deny:
|
||||
- pkg: 'errors'
|
||||
desc: not allowd, use github.com/cockroachdb/errors
|
||||
- pkg: 'github.com/pkg/errors'
|
||||
desc: not allowd, use github.com/cockroachdb/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:
|
||||
forbid:
|
||||
- '^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>
|
||||
getdeps:
|
||||
@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)
|
||||
|
||||
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/panjf2000/ants/v2 v2.7.2
|
||||
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/sbinet/npyio v0.6.0
|
||||
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/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY=
|
||||
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.21/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU=
|
||||
github.com/quasilyte/go-ruleguard/dsl v0.3.22 h1:wd8zkOhSNr+I+8Qeciml08ivDt1pSXe60+5DqOpCjPE=
|
||||
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/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rogpeppe/clock v0.0.0-20190514195947-2896927a307a/go.mod h1:4r5QyqhjIWCcK8DO4KMclc5Iknq5qVBAlbYYzAbUScQ=
|
||||
|
||||
@ -21,6 +21,7 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
@ -67,7 +68,8 @@ func ServeHTTP() {
|
||||
go func() {
|
||||
bindAddr := getHTTPAddr()
|
||||
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))
|
||||
}
|
||||
}()
|
||||
|
||||
@ -29,6 +29,7 @@ type tsoAllocator interface {
|
||||
}
|
||||
|
||||
// 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
|
||||
type timestampAllocatorInterface interface {
|
||||
AllocTimestamp(ctx context.Context, req *rootcoordpb.AllocTimestampRequest) (*rootcoordpb.AllocTimestampResponse, error)
|
||||
|
||||
@ -24,7 +24,6 @@ var (
|
||||
|
||||
// RoundRobinPolicy do the query with multiple dml channels
|
||||
// if request failed, it finds shard leader for failed dml channels
|
||||
//
|
||||
func RoundRobinPolicy(
|
||||
ctx context.Context,
|
||||
mgr *shardClientMgr,
|
||||
|
||||
@ -38,7 +38,7 @@ type deleteNode struct {
|
||||
delegator delegator.ShardDelegator
|
||||
}
|
||||
|
||||
//addDeleteData find the segment of delete column in DeleteMsg and save in deleteData
|
||||
// addDeleteData find the segment of delete column in DeleteMsg and save in deleteData
|
||||
func (dNode *deleteNode) addDeleteData(deleteDatas map[UniqueID]*delegator.DeleteData, msg *DeleteMsg) {
|
||||
deleteData, ok := deleteDatas[msg.PartitionID]
|
||||
if !ok {
|
||||
|
||||
@ -31,7 +31,7 @@ import (
|
||||
"github.com/milvus-io/milvus/pkg/util/typeutil"
|
||||
)
|
||||
|
||||
//test of filter node
|
||||
// test of filter node
|
||||
type FilterNodeSuite struct {
|
||||
suite.Suite
|
||||
//datas
|
||||
@ -74,7 +74,7 @@ func (suite *FilterNodeSuite) SetupSuite() {
|
||||
}
|
||||
}
|
||||
|
||||
//test filter node with collection load collection
|
||||
// test filter node with collection load collection
|
||||
func (suite *FilterNodeSuite) TestWithLoadCollection() {
|
||||
//data
|
||||
suite.validSegmentIDs = []int64{2, 3, 4, 5, 6}
|
||||
@ -109,7 +109,7 @@ func (suite *FilterNodeSuite) TestWithLoadCollection() {
|
||||
suite.Equal(suite.deleteSegmentSum, len(nodeMsg.deleteMsgs))
|
||||
}
|
||||
|
||||
//test filter node with collection load partition
|
||||
// test filter node with collection load partition
|
||||
func (suite *FilterNodeSuite) TestWithLoadPartation() {
|
||||
//data
|
||||
suite.validSegmentIDs = []int64{2, 3, 4, 5, 6}
|
||||
|
||||
@ -29,7 +29,7 @@ import (
|
||||
"github.com/milvus-io/milvus/pkg/util/typeutil"
|
||||
)
|
||||
|
||||
//pipeline used for querynode
|
||||
// pipeline used for querynode
|
||||
type Pipeline interface {
|
||||
base.StreamPipeline
|
||||
ExcludedSegments(segInfos ...*datapb.SegmentInfo)
|
||||
|
||||
@ -28,12 +28,13 @@ import "C"
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/milvus-io/milvus/pkg/common"
|
||||
"github.com/milvus-io/milvus/pkg/util/funcutil"
|
||||
"sort"
|
||||
"sync"
|
||||
"unsafe"
|
||||
|
||||
"github.com/milvus-io/milvus/pkg/common"
|
||||
"github.com/milvus-io/milvus/pkg/util/funcutil"
|
||||
|
||||
"github.com/cockroachdb/errors"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
|
||||
@ -41,7 +41,7 @@ func (suite *TSafeTestSuite) SetupTest() {
|
||||
suite.tSafeReplica = NewTSafeReplica()
|
||||
}
|
||||
|
||||
//test Basic use of TSafeReplica
|
||||
// test Basic use of TSafeReplica
|
||||
func (suite *TSafeTestSuite) TestBasic() {
|
||||
suite.tSafeReplica.Add(suite.channel, ZeroTimestamp)
|
||||
t, err := suite.tSafeReplica.Get(suite.channel)
|
||||
|
||||
@ -31,6 +31,7 @@ func NewMinioClient(address string, opts *minio.Options) (*minio.Client, error)
|
||||
}
|
||||
|
||||
// Credential is defined to mock aliyun credential.Credentials
|
||||
//
|
||||
//go:generate mockery --name=Credential --with-expecter
|
||||
type Credential interface {
|
||||
credentials.Credential
|
||||
|
||||
@ -1320,9 +1320,7 @@ func (dataDefinitionCodec *DataDefinitionCodec) Deserialize(blobs []*Blob) (ts [
|
||||
binlogReader.Close()
|
||||
return nil, nil, err
|
||||
}
|
||||
for idx := range stringPayload {
|
||||
requestsStrings = append(requestsStrings, stringPayload[idx])
|
||||
}
|
||||
requestsStrings = append(requestsStrings, stringPayload...)
|
||||
}
|
||||
eventReader.Close()
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ func (node *BaseNode) Name() string {
|
||||
return node.name
|
||||
}
|
||||
|
||||
//length of pipeline input chnnel
|
||||
// length of pipeline input chnnel
|
||||
func (node *BaseNode) MaxQueueLength() int32 {
|
||||
return node.maxQueueLength
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user