From d3af451d9282b0a8c318648d5cb3b6fac4f283fd Mon Sep 17 00:00:00 2001 From: Enwei Jiao Date: Wed, 7 Jun 2023 19:34:36 +0800 Subject: [PATCH] Upgrade golangci-lint (#24707) Signed-off-by: Enwei Jiao --- .golangci.yml | 25 ++++++++---- Makefile | 2 +- go.mod | 2 +- go.sum | 4 +- internal/http/server.go | 4 +- internal/proxy/interface_def.go | 1 + internal/proxy/mock_tso_test.go | 4 +- internal/proxy/task_policies.go | 1 - internal/querynodev2/cluster/mock_manager.go | 2 +- .../querynodev2/delegator/mock_delegator.go | 38 +++++++++---------- internal/querynodev2/pipeline/delete_node.go | 2 +- .../querynodev2/pipeline/filter_node_test.go | 6 +-- internal/querynodev2/pipeline/pipeline.go | 2 +- internal/querynodev2/segments/mock_loader.go | 24 ++++++------ internal/querynodev2/segments/mock_segment.go | 22 +++++------ internal/querynodev2/segments/segment.go | 5 ++- internal/querynodev2/tsafe/tsafe_test.go | 2 +- internal/storage/aliyun/aliyun.go | 1 + internal/storage/data_codec.go | 4 +- internal/util/pipeline/node.go | 2 +- pkg/util/funcutil/math.go | 2 +- 21 files changed, 83 insertions(+), 72 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 288bef136f..66fb742c7f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -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$' diff --git a/Makefile b/Makefile index 0993f63c8a..9b0f69b136 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ get-build-deps: # attention: upgrade golangci-lint should also change Dockerfiles in build/docker/builder/cpu/ 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 diff --git a/go.mod b/go.mod index 3d5e48b334..7e891012b9 100644 --- a/go.mod +++ b/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 diff --git a/go.sum b/go.sum index b81c6d0101..d7cc541ee9 100644 --- a/go.sum +++ b/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= diff --git a/internal/http/server.go b/internal/http/server.go index ec00595938..5387561df0 100644 --- a/internal/http/server.go +++ b/internal/http/server.go @@ -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)) } }() diff --git a/internal/proxy/interface_def.go b/internal/proxy/interface_def.go index 6851e99e5f..3a908e3a62 100644 --- a/internal/proxy/interface_def.go +++ b/internal/proxy/interface_def.go @@ -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) diff --git a/internal/proxy/mock_tso_test.go b/internal/proxy/mock_tso_test.go index a40a5e9ab5..f00e4fe654 100644 --- a/internal/proxy/mock_tso_test.go +++ b/internal/proxy/mock_tso_test.go @@ -51,8 +51,8 @@ type mockTimestampAllocator_AllocTimestamp_Call struct { } // AllocTimestamp is a helper method to define mock.On call -// - ctx context.Context -// - req *rootcoordpb.AllocTimestampRequest +// - ctx context.Context +// - req *rootcoordpb.AllocTimestampRequest func (_e *mockTimestampAllocator_Expecter) AllocTimestamp(ctx interface{}, req interface{}) *mockTimestampAllocator_AllocTimestamp_Call { return &mockTimestampAllocator_AllocTimestamp_Call{Call: _e.mock.On("AllocTimestamp", ctx, req)} } diff --git a/internal/proxy/task_policies.go b/internal/proxy/task_policies.go index 9b8ccf3830..1f78e7177f 100644 --- a/internal/proxy/task_policies.go +++ b/internal/proxy/task_policies.go @@ -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, diff --git a/internal/querynodev2/cluster/mock_manager.go b/internal/querynodev2/cluster/mock_manager.go index e57bc724b0..82b8f92118 100644 --- a/internal/querynodev2/cluster/mock_manager.go +++ b/internal/querynodev2/cluster/mock_manager.go @@ -46,7 +46,7 @@ type MockManager_GetWorker_Call struct { } // GetWorker is a helper method to define mock.On call -// - nodeID int64 +// - nodeID int64 func (_e *MockManager_Expecter) GetWorker(nodeID interface{}) *MockManager_GetWorker_Call { return &MockManager_GetWorker_Call{Call: _e.mock.On("GetWorker", nodeID)} } diff --git a/internal/querynodev2/delegator/mock_delegator.go b/internal/querynodev2/delegator/mock_delegator.go index bfeb28b5bc..f922a1018a 100644 --- a/internal/querynodev2/delegator/mock_delegator.go +++ b/internal/querynodev2/delegator/mock_delegator.go @@ -163,8 +163,8 @@ type MockShardDelegator_GetStatistics_Call struct { } // GetStatistics is a helper method to define mock.On call -// - ctx context.Context -// - req *querypb.GetStatisticsRequest +// - ctx context.Context +// - req *querypb.GetStatisticsRequest func (_e *MockShardDelegator_Expecter) GetStatistics(ctx interface{}, req interface{}) *MockShardDelegator_GetStatistics_Call { return &MockShardDelegator_GetStatistics_Call{Call: _e.mock.On("GetStatistics", ctx, req)} } @@ -201,9 +201,9 @@ type MockShardDelegator_LoadGrowing_Call struct { } // LoadGrowing is a helper method to define mock.On call -// - ctx context.Context -// - infos []*querypb.SegmentLoadInfo -// - version int64 +// - ctx context.Context +// - infos []*querypb.SegmentLoadInfo +// - version int64 func (_e *MockShardDelegator_Expecter) LoadGrowing(ctx interface{}, infos interface{}, version interface{}) *MockShardDelegator_LoadGrowing_Call { return &MockShardDelegator_LoadGrowing_Call{Call: _e.mock.On("LoadGrowing", ctx, infos, version)} } @@ -240,8 +240,8 @@ type MockShardDelegator_LoadSegments_Call struct { } // LoadSegments is a helper method to define mock.On call -// - ctx context.Context -// - req *querypb.LoadSegmentsRequest +// - ctx context.Context +// - req *querypb.LoadSegmentsRequest func (_e *MockShardDelegator_Expecter) LoadSegments(ctx interface{}, req interface{}) *MockShardDelegator_LoadSegments_Call { return &MockShardDelegator_LoadSegments_Call{Call: _e.mock.On("LoadSegments", ctx, req)} } @@ -269,8 +269,8 @@ type MockShardDelegator_ProcessDelete_Call struct { } // ProcessDelete is a helper method to define mock.On call -// - deleteData []*DeleteData -// - ts uint64 +// - deleteData []*DeleteData +// - ts uint64 func (_e *MockShardDelegator_Expecter) ProcessDelete(deleteData interface{}, ts interface{}) *MockShardDelegator_ProcessDelete_Call { return &MockShardDelegator_ProcessDelete_Call{Call: _e.mock.On("ProcessDelete", deleteData, ts)} } @@ -298,7 +298,7 @@ type MockShardDelegator_ProcessInsert_Call struct { } // ProcessInsert is a helper method to define mock.On call -// - insertRecords map[int64]*InsertData +// - insertRecords map[int64]*InsertData func (_e *MockShardDelegator_Expecter) ProcessInsert(insertRecords interface{}) *MockShardDelegator_ProcessInsert_Call { return &MockShardDelegator_ProcessInsert_Call{Call: _e.mock.On("ProcessInsert", insertRecords)} } @@ -344,8 +344,8 @@ type MockShardDelegator_Query_Call struct { } // Query is a helper method to define mock.On call -// - ctx context.Context -// - req *querypb.QueryRequest +// - ctx context.Context +// - req *querypb.QueryRequest func (_e *MockShardDelegator_Expecter) Query(ctx interface{}, req interface{}) *MockShardDelegator_Query_Call { return &MockShardDelegator_Query_Call{Call: _e.mock.On("Query", ctx, req)} } @@ -382,9 +382,9 @@ type MockShardDelegator_ReleaseSegments_Call struct { } // ReleaseSegments is a helper method to define mock.On call -// - ctx context.Context -// - req *querypb.ReleaseSegmentsRequest -// - force bool +// - ctx context.Context +// - req *querypb.ReleaseSegmentsRequest +// - force bool func (_e *MockShardDelegator_Expecter) ReleaseSegments(ctx interface{}, req interface{}, force interface{}) *MockShardDelegator_ReleaseSegments_Call { return &MockShardDelegator_ReleaseSegments_Call{Call: _e.mock.On("ReleaseSegments", ctx, req, force)} } @@ -430,8 +430,8 @@ type MockShardDelegator_Search_Call struct { } // Search is a helper method to define mock.On call -// - ctx context.Context -// - req *querypb.SearchRequest +// - ctx context.Context +// - req *querypb.SearchRequest func (_e *MockShardDelegator_Expecter) Search(ctx interface{}, req interface{}) *MockShardDelegator_Search_Call { return &MockShardDelegator_Search_Call{Call: _e.mock.On("Search", ctx, req)} } @@ -529,8 +529,8 @@ type MockShardDelegator_SyncDistribution_Call struct { } // SyncDistribution is a helper method to define mock.On call -// - ctx context.Context -// - entries ...SegmentEntry +// - ctx context.Context +// - entries ...SegmentEntry func (_e *MockShardDelegator_Expecter) SyncDistribution(ctx interface{}, entries ...interface{}) *MockShardDelegator_SyncDistribution_Call { return &MockShardDelegator_SyncDistribution_Call{Call: _e.mock.On("SyncDistribution", append([]interface{}{ctx}, entries...)...)} diff --git a/internal/querynodev2/pipeline/delete_node.go b/internal/querynodev2/pipeline/delete_node.go index f6cb765560..73339b7334 100644 --- a/internal/querynodev2/pipeline/delete_node.go +++ b/internal/querynodev2/pipeline/delete_node.go @@ -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 { diff --git a/internal/querynodev2/pipeline/filter_node_test.go b/internal/querynodev2/pipeline/filter_node_test.go index e6f108cc65..c9ac84e30d 100644 --- a/internal/querynodev2/pipeline/filter_node_test.go +++ b/internal/querynodev2/pipeline/filter_node_test.go @@ -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} diff --git a/internal/querynodev2/pipeline/pipeline.go b/internal/querynodev2/pipeline/pipeline.go index a50e728d31..ffcb0fbc92 100644 --- a/internal/querynodev2/pipeline/pipeline.go +++ b/internal/querynodev2/pipeline/pipeline.go @@ -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) diff --git a/internal/querynodev2/segments/mock_loader.go b/internal/querynodev2/segments/mock_loader.go index fb930925ef..9b01430e43 100644 --- a/internal/querynodev2/segments/mock_loader.go +++ b/internal/querynodev2/segments/mock_loader.go @@ -65,11 +65,11 @@ type MockLoader_Load_Call struct { } // Load is a helper method to define mock.On call -// - ctx context.Context -// - collectionID int64 -// - segmentType commonpb.SegmentState -// - version int64 -// - infos ...*querypb.SegmentLoadInfo +// - ctx context.Context +// - collectionID int64 +// - segmentType commonpb.SegmentState +// - version int64 +// - infos ...*querypb.SegmentLoadInfo func (_e *MockLoader_Expecter) Load(ctx interface{}, collectionID interface{}, segmentType interface{}, version interface{}, infos ...interface{}) *MockLoader_Load_Call { return &MockLoader_Load_Call{Call: _e.mock.On("Load", append([]interface{}{ctx, collectionID, segmentType, version}, infos...)...)} @@ -129,10 +129,10 @@ type MockLoader_LoadBloomFilterSet_Call struct { } // LoadBloomFilterSet is a helper method to define mock.On call -// - ctx context.Context -// - collectionID int64 -// - version int64 -// - infos ...*querypb.SegmentLoadInfo +// - ctx context.Context +// - collectionID int64 +// - version int64 +// - infos ...*querypb.SegmentLoadInfo func (_e *MockLoader_Expecter) LoadBloomFilterSet(ctx interface{}, collectionID interface{}, version interface{}, infos ...interface{}) *MockLoader_LoadBloomFilterSet_Call { return &MockLoader_LoadBloomFilterSet_Call{Call: _e.mock.On("LoadBloomFilterSet", append([]interface{}{ctx, collectionID, version}, infos...)...)} @@ -176,9 +176,9 @@ type MockLoader_LoadDeltaLogs_Call struct { } // LoadDeltaLogs is a helper method to define mock.On call -// - ctx context.Context -// - segment *LocalSegment -// - deltaLogs []*datapb.FieldBinlog +// - ctx context.Context +// - segment *LocalSegment +// - deltaLogs []*datapb.FieldBinlog func (_e *MockLoader_Expecter) LoadDeltaLogs(ctx interface{}, segment interface{}, deltaLogs interface{}) *MockLoader_LoadDeltaLogs_Call { return &MockLoader_LoadDeltaLogs_Call{Call: _e.mock.On("LoadDeltaLogs", ctx, segment, deltaLogs)} } diff --git a/internal/querynodev2/segments/mock_segment.go b/internal/querynodev2/segments/mock_segment.go index ac3fb42d10..7b6d9c33ed 100644 --- a/internal/querynodev2/segments/mock_segment.go +++ b/internal/querynodev2/segments/mock_segment.go @@ -37,8 +37,8 @@ type MockSegment_AddIndex_Call struct { } // AddIndex is a helper method to define mock.On call -// - fieldID int64 -// - index *IndexedFieldInfo +// - fieldID int64 +// - index *IndexedFieldInfo func (_e *MockSegment_Expecter) AddIndex(fieldID interface{}, index interface{}) *MockSegment_AddIndex_Call { return &MockSegment_AddIndex_Call{Call: _e.mock.On("AddIndex", fieldID, index)} } @@ -111,8 +111,8 @@ type MockSegment_Delete_Call struct { } // Delete is a helper method to define mock.On call -// - primaryKeys []storage.PrimaryKey -// - timestamps []uint64 +// - primaryKeys []storage.PrimaryKey +// - timestamps []uint64 func (_e *MockSegment_Expecter) Delete(primaryKeys interface{}, timestamps interface{}) *MockSegment_Delete_Call { return &MockSegment_Delete_Call{Call: _e.mock.On("Delete", primaryKeys, timestamps)} } @@ -149,7 +149,7 @@ type MockSegment_ExistIndex_Call struct { } // ExistIndex is a helper method to define mock.On call -// - fieldID int64 +// - fieldID int64 func (_e *MockSegment_Expecter) ExistIndex(fieldID interface{}) *MockSegment_ExistIndex_Call { return &MockSegment_ExistIndex_Call{Call: _e.mock.On("ExistIndex", fieldID)} } @@ -188,7 +188,7 @@ type MockSegment_GetIndex_Call struct { } // GetIndex is a helper method to define mock.On call -// - fieldID int64 +// - fieldID int64 func (_e *MockSegment_Expecter) GetIndex(fieldID interface{}) *MockSegment_GetIndex_Call { return &MockSegment_GetIndex_Call{Call: _e.mock.On("GetIndex", fieldID)} } @@ -299,9 +299,9 @@ type MockSegment_Insert_Call struct { } // Insert is a helper method to define mock.On call -// - rowIDs []int64 -// - timestamps []uint64 -// - record *segcorepb.InsertRecord +// - rowIDs []int64 +// - timestamps []uint64 +// - record *segcorepb.InsertRecord func (_e *MockSegment_Expecter) Insert(rowIDs interface{}, timestamps interface{}, record interface{}) *MockSegment_Insert_Call { return &MockSegment_Insert_Call{Call: _e.mock.On("Insert", rowIDs, timestamps, record)} } @@ -410,7 +410,7 @@ type MockSegment_MayPkExist_Call struct { } // MayPkExist is a helper method to define mock.On call -// - pk storage.PrimaryKey +// - pk storage.PrimaryKey func (_e *MockSegment_Expecter) MayPkExist(pk interface{}) *MockSegment_MayPkExist_Call { return &MockSegment_MayPkExist_Call{Call: _e.mock.On("MayPkExist", pk)} } @@ -656,7 +656,7 @@ type MockSegment_UpdateBloomFilter_Call struct { } // UpdateBloomFilter is a helper method to define mock.On call -// - pks []storage.PrimaryKey +// - pks []storage.PrimaryKey func (_e *MockSegment_Expecter) UpdateBloomFilter(pks interface{}) *MockSegment_UpdateBloomFilter_Call { return &MockSegment_UpdateBloomFilter_Call{Call: _e.mock.On("UpdateBloomFilter", pks)} } diff --git a/internal/querynodev2/segments/segment.go b/internal/querynodev2/segments/segment.go index 00f1822758..a0a5ee273b 100644 --- a/internal/querynodev2/segments/segment.go +++ b/internal/querynodev2/segments/segment.go @@ -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" diff --git a/internal/querynodev2/tsafe/tsafe_test.go b/internal/querynodev2/tsafe/tsafe_test.go index 06ab59a2bd..fa9c1c8064 100644 --- a/internal/querynodev2/tsafe/tsafe_test.go +++ b/internal/querynodev2/tsafe/tsafe_test.go @@ -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) diff --git a/internal/storage/aliyun/aliyun.go b/internal/storage/aliyun/aliyun.go index 63e798ddfe..c4c097941c 100644 --- a/internal/storage/aliyun/aliyun.go +++ b/internal/storage/aliyun/aliyun.go @@ -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 diff --git a/internal/storage/data_codec.go b/internal/storage/data_codec.go index 743571fcba..f978cf631f 100644 --- a/internal/storage/data_codec.go +++ b/internal/storage/data_codec.go @@ -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() } diff --git a/internal/util/pipeline/node.go b/internal/util/pipeline/node.go index ef4c3d0a41..e4fc7242b5 100644 --- a/internal/util/pipeline/node.go +++ b/internal/util/pipeline/node.go @@ -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 } diff --git a/pkg/util/funcutil/math.go b/pkg/util/funcutil/math.go index 51f83cfbf0..4869a43cb8 100644 --- a/pkg/util/funcutil/math.go +++ b/pkg/util/funcutil/math.go @@ -6,7 +6,7 @@ // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS,