Skip to content

Commit

Permalink
fix: ignore parse success variable
Browse files Browse the repository at this point in the history
Signed-off-by: hlts2 <[email protected]>
  • Loading branch information
hlts2 committed Oct 2, 2024
1 parent 906bcda commit 31552df
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
60 changes: 30 additions & 30 deletions pkg/gateway/mirror/handler/grpc/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,8 @@ func (s *server) StreamSearch(stream vald.Search_StreamSearchServer) (err error)
}()
res, err := s.Search(ctx, req)
if err != nil {
st, ok := status.FromError(err)
if !ok || st == nil || st.Message() == "" {
st, _ := status.FromError(err)
if st == nil || st.Message() == "" {

Check warning on line 394 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L393-L394

Added lines #L393 - L394 were not covered by tests
// This condition is implemented just in case to prevent nil pointer errors when retrieving st.Proto(), although it is unlikely to match this condition.
log.Errorf("gRPC call returned not a gRPC status error: %v", err)
st = status.New(codes.Unknown, "failed to parse "+vald.SearchRPCName+" gRPC error response")

Check warning on line 397 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L396-L397

Added lines #L396 - L397 were not covered by tests
Expand Down Expand Up @@ -445,8 +445,8 @@ func (s *server) StreamSearchByID(stream vald.Search_StreamSearchByIDServer) (er
}()
res, err := s.SearchByID(ctx, req)
if err != nil {
st, ok := status.FromError(err)
if !ok || st == nil || st.Message() == "" {
st, _ := status.FromError(err)
if st == nil || st.Message() == "" {

Check warning on line 449 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L448-L449

Added lines #L448 - L449 were not covered by tests
// This condition is implemented just in case to prevent nil pointer errors when retrieving st.Proto(), although it is unlikely to match this condition.
log.Errorf("gRPC call returned not a gRPC status error: %v", err)
st = status.New(codes.Unknown, "failed to parse "+vald.SearchByIDRPCName+" gRPC error response")

Check warning on line 452 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L451-L452

Added lines #L451 - L452 were not covered by tests
Expand Down Expand Up @@ -770,8 +770,8 @@ func (s *server) StreamLinearSearch(stream vald.Search_StreamLinearSearchServer)
}()
res, err := s.LinearSearch(ctx, req)
if err != nil {
st, ok := status.FromError(err)
if !ok || st == nil || st.Message() == "" {
st, _ := status.FromError(err)
if st == nil || st.Message() == "" {

Check warning on line 774 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L773-L774

Added lines #L773 - L774 were not covered by tests
// This condition is implemented just in case to prevent nil pointer errors when retrieving st.Proto(), although it is unlikely to match this condition.
log.Errorf("gRPC call returned not a gRPC status error: %v", err)
st = status.New(codes.Unknown, "failed to parse "+vald.LinearSearchRPCName+" gRPC error response")

Check warning on line 777 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L776-L777

Added lines #L776 - L777 were not covered by tests
Expand Down Expand Up @@ -830,8 +830,8 @@ func (s *server) StreamLinearSearchByID(
}()
res, err := s.LinearSearchByID(ctx, req)
if err != nil {
st, ok := status.FromError(err)
if !ok || st == nil || st.Message() == "" {
st, _ := status.FromError(err)
if st == nil || st.Message() == "" {

Check warning on line 834 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L833-L834

Added lines #L833 - L834 were not covered by tests
// This condition is implemented just in case to prevent nil pointer errors when retrieving st.Proto(), although it is unlikely to match this condition.
log.Errorf("gRPC call returned not a gRPC status error: %v", err)
st = status.New(codes.Unknown, "failed to parse "+vald.LinearSearchByIDRPCName+" gRPC error response")

Check warning on line 837 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L836-L837

Added lines #L836 - L837 were not covered by tests
Expand Down Expand Up @@ -1073,8 +1073,8 @@ func (s *server) handleInsert(
return vc.Insert(ctx, req, copts...)
})
if err != nil {
st, ok := status.FromError(err)
if !ok || st == nil || st.Message() == "" {
st, _ := status.FromError(err)
if st == nil || st.Message() == "" {
// This condition is implemented just in case to prevent nil pointer errors when retrieving st.Code(), although it is unlikely to match this condition.
log.Errorf("gRPC call returned not a gRPC status error: %v", err)
st = status.New(codes.Unknown, "failed to parse "+vald.InsertRPCName+" gRPC error response")

Check warning on line 1080 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L1079-L1080

Added lines #L1079 - L1080 were not covered by tests
Expand Down Expand Up @@ -1230,8 +1230,8 @@ func (s *server) handleInsertResult(
return vc.Update(ctx, req, copts...)
})
if err != nil {
st, ok := status.FromError(err)
if !ok || st == nil || st.Message() == "" {
st, _ := status.FromError(err)
if st == nil || st.Message() == "" {
// This condition is implemented just in case to prevent nil pointer errors when retrieving st.Code(), although it is unlikely to match this condition.
log.Errorf("gRPC call returned not a gRPC status error: %v", err)
st = status.New(codes.Unknown, "failed to parse "+vald.UpdateRPCName+" gRPC error response")

Check warning on line 1237 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L1236-L1237

Added lines #L1236 - L1237 were not covered by tests
Expand Down Expand Up @@ -1427,8 +1427,8 @@ func (s *server) StreamInsert(stream vald.Insert_StreamInsertServer) (err error)
}()
res, err := s.Insert(ctx, req)
if err != nil {
st, ok := status.FromError(err)
if !ok || st == nil || st.Message() == "" {
st, _ := status.FromError(err)
if st == nil || st.Message() == "" {

Check warning on line 1431 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L1430-L1431

Added lines #L1430 - L1431 were not covered by tests
// This condition is implemented just in case to prevent nil pointer errors when retrieving st.Proto(), although it is unlikely to match this condition.
log.Errorf("gRPC call returned not a gRPC status error: %v", err)
st = status.New(codes.Unknown, "failed to parse "+vald.InsertRPCName+" gRPC error response")

Check warning on line 1434 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L1433-L1434

Added lines #L1433 - L1434 were not covered by tests
Expand Down Expand Up @@ -1775,8 +1775,8 @@ func (s *server) handleUpdateResult(
return vc.Insert(ctx, req, copts...)
})
if err != nil {
st, ok := status.FromError(err)
if !ok || st == nil || st.Message() == "" {
st, _ := status.FromError(err)
if st == nil || st.Message() == "" {
// This condition is implemented just in case to prevent nil pointer errors when retrieving st.Code(), although it is unlikely to match this condition.
log.Errorf("gRPC call returned not a gRPC status error: %v", err)
st = status.New(codes.Unknown, "failed to parse "+vald.InsertRPCName+" gRPC error response")

Check warning on line 1782 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L1781-L1782

Added lines #L1781 - L1782 were not covered by tests
Expand Down Expand Up @@ -1986,8 +1986,8 @@ func (s *server) StreamUpdate(stream vald.Update_StreamUpdateServer) (err error)
}()
res, err := s.Update(ctx, req)
if err != nil {
st, ok := status.FromError(err)
if !ok || st == nil || st.Message() == "" {
st, _ := status.FromError(err)
if st == nil || st.Message() == "" {

Check warning on line 1990 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L1989-L1990

Added lines #L1989 - L1990 were not covered by tests
// This condition is implemented just in case to prevent nil pointer errors when retrieving st.Proto(), although it is unlikely to match this condition.
log.Errorf("gRPC call returned not a gRPC status error: %v", err)
st = status.New(codes.Unknown, "failed to parse "+vald.UpdateRPCName+" gRPC error response")

Check warning on line 1993 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L1992-L1993

Added lines #L1992 - L1993 were not covered by tests
Expand Down Expand Up @@ -2163,8 +2163,8 @@ func (s *server) handleUpsert(
return vc.Upsert(ctx, req, copts...)
})
if err != nil {
st, ok := status.FromError(err)
if !ok || st == nil || st.Message() == "" {
st, _ := status.FromError(err)
if st == nil || st.Message() == "" {
// This condition is implemented just in case to prevent nil pointer errors when retrieving st.Code(), although it is unlikely to match this condition.
log.Errorf("gRPC call returned not a gRPC status error: %v", err)
st = status.New(codes.Unknown, "failed to parse "+vald.UpsertRPCName+" gRPC error response")

Check warning on line 2170 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L2169-L2170

Added lines #L2169 - L2170 were not covered by tests
Expand Down Expand Up @@ -2358,8 +2358,8 @@ func (s *server) StreamUpsert(stream vald.Upsert_StreamUpsertServer) (err error)
}()
res, err := s.Upsert(ctx, req)
if err != nil {
st, ok := status.FromError(err)
if !ok || st == nil || st.Message() == "" {
st, _ := status.FromError(err)
if st == nil || st.Message() == "" {

Check warning on line 2362 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L2361-L2362

Added lines #L2361 - L2362 were not covered by tests
// This condition is implemented just in case to prevent nil pointer errors when retrieving st.Proto(), although it is unlikely to match this condition.
log.Errorf("gRPC call returned not a gRPC status error: %v", err)
st = status.New(codes.Unknown, "failed to parse "+vald.UpsertRPCName+" gRPC error response")

Check warning on line 2365 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L2364-L2365

Added lines #L2364 - L2365 were not covered by tests
Expand Down Expand Up @@ -2727,8 +2727,8 @@ func (s *server) StreamRemove(stream vald.Remove_StreamRemoveServer) (err error)
}()
res, err := s.Remove(ctx, req)
if err != nil {
st, ok := status.FromError(err)
if !ok || st == nil || st.Message() == "" {
st, _ := status.FromError(err)
if st == nil || st.Message() == "" {

Check warning on line 2731 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L2730-L2731

Added lines #L2730 - L2731 were not covered by tests
// This condition is implemented just in case to prevent nil pointer errors when retrieving st.Proto(), although it is unlikely to match this condition.
log.Errorf("gRPC call returned not a gRPC status error: %v", err)
st = status.New(codes.Unknown, "failed to parse "+vald.RemoveRPCName+" gRPC error response")

Check warning on line 2734 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L2733-L2734

Added lines #L2733 - L2734 were not covered by tests
Expand Down Expand Up @@ -2857,8 +2857,8 @@ func (s *server) RemoveByTimestamp(
return locs, errors.Join(derr, err)
})
if err != nil {
st, ok := status.FromError(err)
if !ok || st == nil || st.Message() == "" {
st, _ := status.FromError(err)
if st == nil || st.Message() == "" {

Check warning on line 2861 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L2860-L2861

Added lines #L2860 - L2861 were not covered by tests
// This condition is implemented just in case to prevent nil pointer errors when retrieving st.Code(), although it is unlikely to match this condition.
log.Errorf("gRPC call returned not a gRPC status error: %v", err)
st = status.New(codes.Unknown, "failed to parse "+vald.InsertRPCName+" gRPC error response")

Check warning on line 2864 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L2863-L2864

Added lines #L2863 - L2864 were not covered by tests
Expand Down Expand Up @@ -2907,8 +2907,8 @@ func (s *server) handleRemoveByTimestamp(
return vc.RemoveByTimestamp(ctx, req, copts...)
})
if err != nil {
st, ok := status.FromError(err)
if !ok || st == nil || st.Message() == "" {
st, _ := status.FromError(err)
if st == nil || st.Message() == "" {
// This condition is implemented just in case to prevent nil pointer errors when retrieving st.Code(), although it is unlikely to match this condition.
log.Errorf("gRPC call returned not a gRPC status error: %v", err)
st = status.New(codes.Unknown, "failed to parse "+vald.RemoveByTimestampRPCName+" gRPC error response")

Check warning on line 2914 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L2913-L2914

Added lines #L2913 - L2914 were not covered by tests
Expand Down Expand Up @@ -3164,8 +3164,8 @@ func (s *server) StreamGetObject(stream vald.Object_StreamGetObjectServer) (err
}()
res, err := s.GetObject(ctx, req)
if err != nil {
st, ok := status.FromError(err)
if !ok || st == nil || st.Message() == "" {
st, _ := status.FromError(err)
if st == nil || st.Message() == "" {

Check warning on line 3168 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L3167-L3168

Added lines #L3167 - L3168 were not covered by tests
// This condition is implemented just in case to prevent nil pointer errors when retrieving st.Proto(), although it is unlikely to match this condition.
log.Errorf("gRPC call returned not a gRPC status error: %v", err)
st = status.New(codes.Internal, "failed to parse "+vald.GetObjectRPCName+" gRPC error response")

Check warning on line 3171 in pkg/gateway/mirror/handler/grpc/handler.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/handler/grpc/handler.go#L3170-L3171

Added lines #L3170 - L3171 were not covered by tests
Expand Down
4 changes: 2 additions & 2 deletions pkg/gateway/mirror/service/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ func (m *mirr) registers(
)
attrs = trace.StatusCodeInvalidArgument(err.Error())
default:
st, ok := status.FromError(err)
if !ok || st == nil || st.Message() == "" {
st, _ := status.FromError(err)
if st == nil || st.Message() == "" {

Check warning on line 219 in pkg/gateway/mirror/service/mirror.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/service/mirror.go#L218-L219

Added lines #L218 - L219 were not covered by tests
// This condition is implemented just in case to prevent nil pointer errors when retrieving st.Code() and st.Message(), although it is unlikely to match this condition.
log.Errorf("gRPC call returned not a gRPC status error: %v", err)
st = status.New(codes.Unknown, "failed to parse "+mirror.RegisterRPCName+" gRPC error response")

Check warning on line 222 in pkg/gateway/mirror/service/mirror.go

View check run for this annotation

Codecov / codecov/patch

pkg/gateway/mirror/service/mirror.go#L221-L222

Added lines #L221 - L222 were not covered by tests
Expand Down

0 comments on commit 31552df

Please sign in to comment.