Skip to content

Commit 114989e

Browse files
committed
protovalidate: do not allocate an error
1 parent 0cf5a8e commit 114989e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

interceptors/protovalidate/protovalidate.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ func validateMsg(m interface{}, validator *protovalidate.Validator, opts *option
7777
if err == nil {
7878
return nil
7979
}
80-
if valErr := new(protovalidate.ValidationError); errors.As(err, &valErr) {
80+
var valErr *protovalidate.ValidationError
81+
if errors.As(err, &valErr) {
8182
// Message is invalid.
8283
st := status.New(codes.InvalidArgument, err.Error())
8384
ds, detErr := st.WithDetails(valErr.ToProto())

0 commit comments

Comments
 (0)