enhance: [GoSDK] Sync latest milvus proto and mockery (#35511)

Related to #35443

---------

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
congqixia 2024-08-19 16:22:55 +08:00 committed by GitHub
parent b96db798b9
commit b4743b4ca8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 286 additions and 17 deletions

View File

@ -188,7 +188,7 @@ static-check: getdeps
@echo "Start check client package"
@source $(PWD)/scripts/setenv.sh && cd client && GO111MODULE=on GOFLAGS=-buildvcs=false $(INSTALL_PATH)/golangci-lint run --timeout=30m --config $(PWD)/client/.golangci.yml
@echo "Start check go_client e2e package"
@source $(PWD)/scripts/setenv.sh && cd tests/go_client && GO111MODULE=on GOFLAGS=-buildvcs=false $(INSTALL_PATH)/golangci-lint run --timeout=30m --config $(PWD)/client/.golangci.yml
@source $(PWD)/scripts/setenv.sh && cd tests/go_client && GO111MODULE=on GOFLAGS=-buildvcs=false $(INSTALL_PATH)/golangci-lint run --build-tags L0,L1,L2,test --timeout=30m --config $(PWD)/tests/go_client/.golangci.yml
verifiers: build-cpp getdeps cppcheck fmt static-check

View File

@ -6,7 +6,7 @@ require (
github.com/blang/semver/v4 v4.0.0
github.com/cockroachdb/errors v1.9.1
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20240717062137-3ffb1db01632
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20240815123953-6dab6fcd6454
github.com/milvus-io/milvus/pkg v0.0.2-0.20240801085213-a642a26ed4c6
github.com/quasilyte/go-ruleguard/dsl v0.3.22
github.com/samber/lo v1.27.0

View File

@ -390,8 +390,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfr
github.com/mediocregopher/radix/v3 v3.4.2/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8=
github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20240717062137-3ffb1db01632 h1:CXig0DNtUsCLzchCFe3PR2KgOdobbz9gK2nSV7195PM=
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20240717062137-3ffb1db01632/go.mod h1:/6UT4zZl6awVeXLeE7UGDWZvXj3IWkRsh3mqsn0DiAs=
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20240815123953-6dab6fcd6454 h1:JmZCYjMPpiE4ksZw0AUxXWkDY7wwA4fhS+SO1N211Vw=
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20240815123953-6dab6fcd6454/go.mod h1:/6UT4zZl6awVeXLeE7UGDWZvXj3IWkRsh3mqsn0DiAs=
github.com/milvus-io/milvus/pkg v0.0.2-0.20240801085213-a642a26ed4c6 h1:dotu470D/DkctdLHsTCCmuvAD3h5C8gkFhMxb0Zlu7A=
github.com/milvus-io/milvus/pkg v0.0.2-0.20240801085213-a642a26ed4c6/go.mod h1:tdeEcpeaAcrIJgrr6LVzu7SYl9zn18dNKZwPmCUb0Io=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=

View File

@ -302,6 +302,61 @@ func (_c *MilvusServiceServer_AlterIndex_Call) RunAndReturn(run func(context.Con
return _c
}
// BackupRBAC provides a mock function with given fields: _a0, _a1
func (_m *MilvusServiceServer) BackupRBAC(_a0 context.Context, _a1 *milvuspb.BackupRBACMetaRequest) (*milvuspb.BackupRBACMetaResponse, error) {
ret := _m.Called(_a0, _a1)
var r0 *milvuspb.BackupRBACMetaResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.BackupRBACMetaRequest) (*milvuspb.BackupRBACMetaResponse, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.BackupRBACMetaRequest) *milvuspb.BackupRBACMetaResponse); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*milvuspb.BackupRBACMetaResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.BackupRBACMetaRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MilvusServiceServer_BackupRBAC_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BackupRBAC'
type MilvusServiceServer_BackupRBAC_Call struct {
*mock.Call
}
// BackupRBAC is a helper method to define mock.On call
// - _a0 context.Context
// - _a1 *milvuspb.BackupRBACMetaRequest
func (_e *MilvusServiceServer_Expecter) BackupRBAC(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_BackupRBAC_Call {
return &MilvusServiceServer_BackupRBAC_Call{Call: _e.mock.On("BackupRBAC", _a0, _a1)}
}
func (_c *MilvusServiceServer_BackupRBAC_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.BackupRBACMetaRequest)) *MilvusServiceServer_BackupRBAC_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*milvuspb.BackupRBACMetaRequest))
})
return _c
}
func (_c *MilvusServiceServer_BackupRBAC_Call) Return(_a0 *milvuspb.BackupRBACMetaResponse, _a1 error) *MilvusServiceServer_BackupRBAC_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MilvusServiceServer_BackupRBAC_Call) RunAndReturn(run func(context.Context, *milvuspb.BackupRBACMetaRequest) (*milvuspb.BackupRBACMetaResponse, error)) *MilvusServiceServer_BackupRBAC_Call {
_c.Call.Return(run)
return _c
}
// CalcDistance provides a mock function with given fields: _a0, _a1
func (_m *MilvusServiceServer) CalcDistance(_a0 context.Context, _a1 *milvuspb.CalcDistanceRequest) (*milvuspb.CalcDistanceResults, error) {
ret := _m.Called(_a0, _a1)
@ -4152,6 +4207,61 @@ func (_c *MilvusServiceServer_ReplicateMessage_Call) RunAndReturn(run func(conte
return _c
}
// RestoreRBAC provides a mock function with given fields: _a0, _a1
func (_m *MilvusServiceServer) RestoreRBAC(_a0 context.Context, _a1 *milvuspb.RestoreRBACMetaRequest) (*commonpb.Status, error) {
ret := _m.Called(_a0, _a1)
var r0 *commonpb.Status
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.RestoreRBACMetaRequest) (*commonpb.Status, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.RestoreRBACMetaRequest) *commonpb.Status); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*commonpb.Status)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.RestoreRBACMetaRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MilvusServiceServer_RestoreRBAC_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RestoreRBAC'
type MilvusServiceServer_RestoreRBAC_Call struct {
*mock.Call
}
// RestoreRBAC is a helper method to define mock.On call
// - _a0 context.Context
// - _a1 *milvuspb.RestoreRBACMetaRequest
func (_e *MilvusServiceServer_Expecter) RestoreRBAC(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_RestoreRBAC_Call {
return &MilvusServiceServer_RestoreRBAC_Call{Call: _e.mock.On("RestoreRBAC", _a0, _a1)}
}
func (_c *MilvusServiceServer_RestoreRBAC_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.RestoreRBACMetaRequest)) *MilvusServiceServer_RestoreRBAC_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*milvuspb.RestoreRBACMetaRequest))
})
return _c
}
func (_c *MilvusServiceServer_RestoreRBAC_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_RestoreRBAC_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MilvusServiceServer_RestoreRBAC_Call) RunAndReturn(run func(context.Context, *milvuspb.RestoreRBACMetaRequest) (*commonpb.Status, error)) *MilvusServiceServer_RestoreRBAC_Call {
_c.Call.Return(run)
return _c
}
// Search provides a mock function with given fields: _a0, _a1
func (_m *MilvusServiceServer) Search(_a0 context.Context, _a1 *milvuspb.SearchRequest) (*milvuspb.SearchResults, error) {
ret := _m.Called(_a0, _a1)

View File

@ -1,7 +1,90 @@
include:
- "../../.golangci.yml"
run:
go: "1.21"
skip-dirs:
- build
- configs
- deployments
- docs
- scripts
- internal/core
- cmake_build
skip-files:
- partial_search_test.go
linters:
disable-all: true
enable:
- gosimple
- govet
- ineffassign
- staticcheck
- decorder
- depguard
- gofmt
- goimports
- gosec
- revive
- unconvert
- misspell
- typecheck
- durationcheck
- forbidigo
- gci
- whitespace
- gofumpt
- gocritic
linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/milvus-io)
custom-order: true
gofumpt:
lang-version: "1.18"
module-path: github.com/milvus-io
goimports:
local-prefixes: github.com/milvus-io
revive:
rules:
- name: unused-parameter
disabled: true
- name: var-naming
severity: warning
disabled: false
arguments:
- ["ID"] # Allow list
- name: context-as-argument
severity: warning
disabled: false
arguments:
- allowTypesBefore: "*testing.T"
- name: datarace
severity: warning
disabled: false
- name: duplicated-imports
severity: warning
disabled: false
- name: waitgroup-by-value
severity: warning
disabled: false
- name: indent-error-flow
severity: warning
disabled: false
arguments:
- "preserveScope"
- name: range-val-in-closure
severity: warning
disabled: false
- name: range-val-address
severity: warning
disabled: false
- name: string-of-int
severity: warning
disabled: false
misspell:
locale: US
gocritic:
enabled-checks:
- ruleguard
@ -9,3 +92,81 @@ linters-settings:
ruleguard:
failOnError: true
rules: "ruleguard/rules.go"
depguard:
rules:
main:
deny:
- pkg: "errors"
desc: not allowed, use github.com/cockroachdb/errors
- pkg: "github.com/pkg/errors"
desc: not allowed, use github.com/cockroachdb/errors
- pkg: "github.com/pingcap/errors"
desc: not allowed, use github.com/cockroachdb/errors
- pkg: "golang.org/x/xerrors"
desc: not allowed, use github.com/cockroachdb/errors
- pkg: "github.com/go-errors/errors"
desc: not allowed, use github.com/cockroachdb/errors
- pkg: "io/ioutil"
desc: ioutil is deprecated after 1.16, 1.17, use os and io package instead
- pkg: "github.com/tikv/client-go/rawkv"
desc: not allowed, use github.com/tikv/client-go/v2/txnkv
- pkg: "github.com/tikv/client-go/v2/rawkv"
desc: not allowed, use github.com/tikv/client-go/v2/txnkv
forbidigo:
forbid:
- '^time\.Tick$'
- 'return merr\.Err[a-zA-Z]+'
- 'merr\.Wrap\w+\(\)\.Error\(\)'
- '\.(ErrorCode|Reason) = '
- 'Reason:\s+\w+\.Error\(\)'
- 'errors.New\((.+)\.GetReason\(\)\)'
- 'commonpb\.Status\{[\s\n]*ErrorCode:[\s\n]*.+[\s\S\n]*?\}'
- 'os\.Open\(.+\)'
- 'os\.ReadFile\(.+\)'
- 'os\.WriteFile\(.+\)'
- "runtime.NumCPU"
- "runtime.GOMAXPROCS(0)"
#- 'fmt\.Print.*' WIP
issues:
exclude-use-default: false
exclude-rules:
- path: .+_test\.go
linters:
- forbidigo
exclude:
- should have a package comment
- should have comment
- should be of the form
- should not use dot imports
- which can be annoying to use
# Binds to all network interfaces
- G102
# Use of unsafe calls should be audited
- G103
# Errors unhandled
- G104
# file/folder Permission
- G301
- G302
# Potential file inclusion via variable
- G304
# Deferring unsafe method like *os.File Close
- G307
# TLS MinVersion too low
- G402
# Use of weak random number generator math/rand
- G404
# Unused parameters
- SA1019
# defer return errors
- SA5001
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0
service:
# use the fixed version to not introduce new linters unexpectedly
golangci-lint-version: 1.55.2

View File

@ -55,7 +55,7 @@ require (
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20240717062137-3ffb1db01632 // indirect
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20240815123953-6dab6fcd6454 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect

View File

@ -388,10 +388,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfr
github.com/mediocregopher/radix/v3 v3.4.2/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8=
github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20240717062137-3ffb1db01632 h1:CXig0DNtUsCLzchCFe3PR2KgOdobbz9gK2nSV7195PM=
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20240717062137-3ffb1db01632/go.mod h1:/6UT4zZl6awVeXLeE7UGDWZvXj3IWkRsh3mqsn0DiAs=
github.com/milvus-io/milvus/client/v2 v2.0.0-20240805024817-4b553b0333f4 h1:0VEsc69duq3NMNRYWq0qtJDN6HSj13USju1ZdlmvUo0=
github.com/milvus-io/milvus/client/v2 v2.0.0-20240805024817-4b553b0333f4/go.mod h1:p2fU+bPgEy+OBYUvhE1+ABEp3KaFQyY586DSs6iEDHk=
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20240815123953-6dab6fcd6454 h1:JmZCYjMPpiE4ksZw0AUxXWkDY7wwA4fhS+SO1N211Vw=
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20240815123953-6dab6fcd6454/go.mod h1:/6UT4zZl6awVeXLeE7UGDWZvXj3IWkRsh3mqsn0DiAs=
github.com/milvus-io/milvus/pkg v0.0.2-0.20240801085213-a642a26ed4c6 h1:dotu470D/DkctdLHsTCCmuvAD3h5C8gkFhMxb0Zlu7A=
github.com/milvus-io/milvus/pkg v0.0.2-0.20240801085213-a642a26ed4c6/go.mod h1:tdeEcpeaAcrIJgrr6LVzu7SYl9zn18dNKZwPmCUb0Io=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=