Fix golint warnings for proxy (#11894)

Signed-off-by: yudong.cai <yudong.cai@zilliz.com>
This commit is contained in:
Cai Yudong 2021-11-29 12:23:17 +08:00 committed by GitHub
parent e62e7bb801
commit 33bfd96d9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View File

@ -1952,7 +1952,7 @@ func (node *Proxy) CalcDistance(ctx context.Context, request *milvuspb.CalcDista
}
if retrievedIds == nil || retrievedVectors == nil {
return nil, errors.New("Failed to fetch vectors")
return nil, errors.New("failed to fetch vectors")
}
dict := make(map[int64]int)
@ -1969,7 +1969,7 @@ func (node *Proxy) CalcDistance(ctx context.Context, request *milvuspb.CalcDista
index, ok := dict[id]
if !ok {
log.Error("id not found in CalcDistance", zap.Int64("id", id))
return nil, errors.New("Failed to fetch vectors by id: " + fmt.Sprintln(id))
return nil, errors.New("failed to fetch vectors by id: " + fmt.Sprintln(id))
}
result = append(result, floatArr[int64(index)*element:int64(index+1)*element]...)
}
@ -1996,7 +1996,7 @@ func (node *Proxy) CalcDistance(ctx context.Context, request *milvuspb.CalcDista
index, ok := dict[id]
if !ok {
log.Error("id not found in CalcDistance", zap.Int64("id", id))
return nil, errors.New("Failed to fetch vectors by id: " + fmt.Sprintln(id))
return nil, errors.New("failed to fetch vectors by id: " + fmt.Sprintln(id))
}
result = append(result, binaryArr[int64(index)*element:int64(index+1)*element]...)
}
@ -2009,7 +2009,7 @@ func (node *Proxy) CalcDistance(ctx context.Context, request *milvuspb.CalcDista
}, nil
}
return nil, errors.New("Failed to fetch vectors")
return nil, errors.New("failed to fetch vectors")
}
log.Debug("grpc calcDistance begin")
@ -2154,9 +2154,9 @@ func (node *Proxy) CalcDistance(ctx context.Context, request *milvuspb.CalcDista
}
}
err = errors.New("Unexpected error")
err = errors.New("unexpected error")
if (vectorsLeft.GetBinaryVector() != nil && vectorsRight.GetFloatVector() != nil) || (vectorsLeft.GetFloatVector() != nil && vectorsRight.GetBinaryVector() != nil) {
err = errors.New("Cannot calculate distance between binary vectors and float vectors")
err = errors.New("cannot calculate distance between binary vectors and float vectors")
}
return &milvuspb.CalcDistanceResults{

View File

@ -391,7 +391,7 @@ func (sa *segIDAssigner) GetSegmentID(collID UniqueID, partitionID UniqueID, cha
}
sa.Reqs <- req
if err := req.Wait(); err != nil {
return nil, fmt.Errorf("GetSegmentID failed: %s", err)
return nil, fmt.Errorf("getSegmentID failed: %s", err)
}
return req.segInfo, nil

View File

@ -251,7 +251,7 @@ func (mockD *mockDataCoord5) AssignSegmentID(ctx context.Context, req *datapb.As
ErrorCode: commonpb.ErrorCode_UnexpectedError,
Reason: "Just For Test",
},
}, fmt.Errorf("Just for test")
}, fmt.Errorf("just for test")
}
func TestSegmentAllocator5(t *testing.T) {