You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove extraneous top-level struct args to IsAnyNilOrZero (#8651)
We frequently call `core.IsAnyNilOrZero(obj, obj.field)`, to check both
that the object (usually a gRPC request) is not nil, and that the
required field on the object is not nil. This is pointless for two
reasons:
1) gRPC guarantees that the request object will never be nil, so
checking the top-level object is wasted effort.
2) If the object were nil, then attempting to pass `obj.field` as the
second argument to IsAnyNilOrZero will result in a nil pointer
dereference panic before that function even gets to evaluate its first
argument. This can be seen here: https://go.dev/play/p/duQK2ZbnxqK
Remove these extraneous first arguments, and operate under the
assumption that the request object itself is never nil.
0 commit comments