Skip to content

Commit

Permalink
protovalidate: do not allocate an error
Browse files Browse the repository at this point in the history
  • Loading branch information
ash2k committed Aug 16, 2024
1 parent 0cf5a8e commit 114989e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion interceptors/protovalidate/protovalidate.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ func validateMsg(m interface{}, validator *protovalidate.Validator, opts *option
if err == nil {
return nil
}
if valErr := new(protovalidate.ValidationError); errors.As(err, &valErr) {
var valErr *protovalidate.ValidationError
if errors.As(err, &valErr) {
// Message is invalid.
st := status.New(codes.InvalidArgument, err.Error())
ds, detErr := st.WithDetails(valErr.ToProto())
Expand Down

0 comments on commit 114989e

Please sign in to comment.