Skip to content

runner: replace deprecated jhump/protoreflect/desc in BinaryDataFunc - #468

Open
mkysel wants to merge 1 commit into
bojand:masterfrom
mkysel:master
Open

runner: replace deprecated jhump/protoreflect/desc in BinaryDataFunc#468
mkysel wants to merge 1 commit into
bojand:masterfrom
mkysel:master

Conversation

@mkysel

@mkysel mkysel commented Mar 9, 2026

Copy link
Copy Markdown

Problem

BinaryDataFunc and WithBinaryDataFunc expose *desc.MethodDescriptor
from github.com/jhump/protoreflect/desc in their public API. That package
is deprecated upstream with the recommendation to migrate to
google.golang.org/protobuf/reflect/protoreflect.

This forces callers to import the deprecated package just to satisfy the
function signature — even when the mtd parameter is unused (which is the
common case for binary data functions).

Solution

  • Change BinaryDataFunc to accept protoreflect.MethodDescriptor (the
    standard interface from Google's v2 protobuf package) instead of
    *desc.MethodDescriptor
  • At the internal call site in data.go, convert via (*desc.MethodDescriptor).UnwrapMethod()
    before passing to the user function

Breaking change

Any caller that currently references *desc.MethodDescriptor in their
BinaryDataFunc will need to update the parameter type to
protoreflect.MethodDescriptor. Since google.golang.org/protobuf is
already a transitive dependency of ghz, no new dependency is introduced.

The BinaryDataFunc type and WithBinaryDataFunc option exposed
*desc.MethodDescriptor from github.com/jhump/protoreflect/desc in their
public signatures. This package is deprecated in favour of the official
google.golang.org/protobuf/reflect/protoreflect API.

Callers who use WithBinaryDataFunc are forced to import the deprecated
package solely to satisfy the function signature, even when they ignore
the mtd parameter entirely.

Replace *desc.MethodDescriptor with the standard protoreflect.MethodDescriptor
interface at the public boundary. Internally, the existing *desc.MethodDescriptor
is converted via its UnwrapMethod() accessor before being passed to the
user-supplied function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant